Estoy empezando a jugar con el nuevo cursorLoader y estoy teniendo problemas. El siguiente código es sólo para entender cómo funciona el cursorLoader pero aparece:Android CursorLoader
"Tratar de volver a consultar y el cursor ya cerrado", cuando reanudo esta actividad. La aplicación funcionaba bien antes de comenzar a jugar con el cursorLoader. ¿Algunas ideas?
private Cursor getSectionData(CharSequence parent_id) {
String[] projection = new String[] {Titles.SECTION, Titles.TITLE, Titles._ID, Titles.CODE_RANGE,};
Uri titles = Titles.CONTENT_URI;
String select = "" + Titles.PARENT_ID + " match " + parent_id + "";
CursorLoader loader = new CursorLoader(this, titles, projection, select, null, null);
Cursor cTitles = loader.loadInBackground();
String[] projection1 = new String[] {Codes.CODE, Codes.EXCERPT, Codes._ID,};
Uri codes = Codes.CONTENT_URI;
String select1 = "" + Codes.PARENT_ID + " match " + parent_id + "";
CursorLoader loader1 = new CursorLoader(this, codes, projection1, select1, null, null);
Cursor cCodes = loader1.loadInBackground();
//Cursor cTitles = db.rawQuery("select section, title, _id, code_range from titles where parent_id match " + parent_id + "", null);
//startManagingCursor(cTitles);
//Cursor cCodes = db.rawQuery("select code, excerpt, _id from codes where parent_id match " + parent_id + "", null);
mQuery = "select code, excerpt, _id from codes where parent_id match " + parent_id + "";
//startManagingCursor(cCodes);
Cursor[] c = {cTitles, cCodes};
Cursor cursor = new MergeCursor(c);
startManagingCursor(cursor);
return cursor;
}
me sale El método registerListener (int, Loader.OnLoadCompleteListener) en el cargador de tipo no es aplicable a los argumentos (int, LoaderManager.LoaderCallbacks ) –
max4ever
Esta publicación es un poco antigua, no estoy seguro si actualizaron algo. ¿Intentó crear un OnLoadCompleteListener en lugar de usar los LoaderCallbacks? –