getLoaderManager (). initLoader () não aceita 'this' como argumento embora a classe (ListFragment) implemente LoaderManager.LoaderCallbacks <Cursor>
Estou tendo problemas para seguir umguia sobre o uso do SQLite no Android. Estou usando umListFragment
em vez de umListActivity
(como no exemplo), então eu tenho oListFragment
implementoLoaderManager.LoaderCallbacks<Cursor>
em vez de. Então, nofillData()
método noListFragment
:
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);
}
Eu recebo o erro:
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is not applicable for the arguments (int, null, NotesActivity.ArrayListFragment)
na linha marcada, emborathis
implementaLoaderManager.LoaderCallbacks<Cursor>
.
Obrigado por qualquer ideia.