I need help with this error:
Fatal Exception: java.lang.IllegalStateException: Couldn't read row 24929, col 0 from CursorWindow.
Make sure the Cursor is initialized correctly before accessing data from it
In this code:
SQLiteDatabase db = getReadableDatabase();
Cursor res = db.rawQuery("select id from " + pTable, null);
if (res != null) {
if (res.getCount() != 0) {
res.moveToFirst();
int id;
while (!res.isAfterLast()) {
id = res.getInt(res.getColumnIndex("id")); // <-- Error was here
// ...
res.moveToNext();
}
}
res.close();
}
This code works sometimes, but when I have many rows (like 25k rows) I get this Exception. Is it a Android restriction?
Could you help me with that? Thanks!