getLoaderManager (). initLoader () akzeptiert dieses Argument nicht, obwohl die Klasse (ListFragment) LoaderManager.LoaderCallbacks <Cursor> implementiert

Ich habe Probleme, aführen zur Verwendung von SQLite in Android. Ich benutze eineListFragment anstelle einerListActivity(wie im Beispiel), also habe ich dieListFragment implementierenLoaderManager.LoaderCallbacks<Cursor> stattdessen. Dann in derfillData() Methode in derListFragment:

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);
}

Ich erhalte den Fehler:

The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is not applicable for the arguments (int, null, NotesActivity.ArrayListFragment)

obwohl auf der markierten Liniethis implementiertLoaderManager.LoaderCallbacks<Cursor>.

Vielen Dank für alle Ideen.

Antworten auf die Frage(15)

Ihre Antwort auf die Frage