I have a populated Database in my app but I'm having trouble to access data through a returned cursor from the query method.
Cursor query = getContentResolver().query(MoviesContract.MoviesEntry.CONTENT_URI,
null,
null,
null,
null);
query.moveToFirst();
while (query.isAfterLast() == false){
Log.d("Test", query.getString(0));
query.moveToNext();
}
I'm doing tests on this block of code. When I execute the Log.d line, this error is raised:
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
This is how I know my database has content:
What I'm missing? It's my first time dealing with cursors.
Found the problem:
CursorWindow: Window is full: requested allocation 1369680 bytes, free space 596540 bytes, window size 2097152 bytes
I was storing images into the Database.
I'm going to change my architecture to store the image from the webservice with the Offline Caching of Picasso.