I'm defining my cursor and reading from it like so:
1 Cursor photosCursor = Handset.binaryDB.rawQuery("SELECT Caption,data FROM Photos ORDER BY CreateDateTime ASC",null);
2 Log.d("populateImages","Found images: " + photosCursor.getCount());
3 if(photosCursor.moveToFirst()){
4 String caption = photosCursor.getString(photosCursor.getColumnIndexOrThrow("Caption"));
...
On Line 4, it crashes with this error:
E/CursorWindow﹕ Failed to read row 0, column 0 from a CursorWindow which has 0 rows, 2 columns.
Now, it says it has 0 rows, but the debug message from the code says otherwise:
D/populateImages﹕ Found images: 2
I've double checked the schema, made sure there were no typos. Tried dropping, recreating, and reinserting records into the table.
What could cause it to say 0 rows from the error while there are actually rows being reported by the cursor in the debug message?
Aucun commentaire:
Enregistrer un commentaire