getLoaderManager (). initLoader () nie akceptuje „this” jako argumentu, chociaż klasa (ListFragment) implementuje LoaderManager.LoaderCallbacks <Kursor>
Mam kłopoty z następowaniem poprzewodnik na temat używania SQLite w Androidzie. UżywamListFragment
zamiastListActivity
(jak w przykładzie), więc mamListFragment
wprowadzić w życieLoaderManager.LoaderCallbacks<Cursor>
zamiast. Następnie wfillData()
metoda wListFragment
:
private void fillData() {
// Fields from the database (projection)
// Must include the _id column for the adapter to work
String[] from = new String[] { NotesSQLiteHelper.COLUMN_TITLE };
// Fields on the UI to which we map
int[] to = new int[] { R.id.label };
getLoaderManager().initLoader(0, null, this); //error
adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.notes_row, null, from, to, 0);
setListAdapter(adapter);
}
Dostaję błąd:
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is not applicable for the arguments (int, null, NotesActivity.ArrayListFragment)
na zaznaczonej liniithis
narzędziaLoaderManager.LoaderCallbacks<Cursor>
.
Dziękuję za wszelkie pomysły.