getLoaderManager (). initLoader () no acepta 'this' como argumento aunque la clase (ListFragment) implementa LoaderManager.LoaderCallbacks <Cursor>
Estoy teniendo problemas para seguir unguía sobre el uso de SQLite en Android. Estoy usando unListFragment
en vez de unaListActivity
(como en el ejemplo), así que tengo laListFragment
implementarLoaderManager.LoaderCallbacks<Cursor>
en lugar. Luego, en elfillData()
método en elListFragment
:
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);
}
Me sale el error:
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is not applicable for the arguments (int, null, NotesActivity.ArrayListFragment)
en la linea marcada aunquethis
implementosLoaderManager.LoaderCallbacks<Cursor>
.
Gracias por cualquier idea.