I have got a type of heavy Android application and wish to make certain not never ANR it.

I have moved my database queries from the UI thread (to AsyncTasks), however i still read in the cursor within the ui thread since i have imagine that the came back cursor is saved somewhere in memory, i.e. the particular reading through of it doesn't go the whole method to the database. Is the fact that correct or will i really should move all reads from the cursor to non UI threads too?

To become more specific:

Does for instance http://developer.android.com/reference/android/database/Cursor.html#getInt(int) read from memeory, or will it obtain some type of read lock in the actual SQLite database.

I suppose the Cursor implementation during my situation is definitely an SQLiteCursor because the ContentProvider is implemented utilizing an SQLite database.

Whenever you call query() or rawQuery() on the SQLiteDatabase, a Cursor is came back immediately, since the actual query is postponed before you begin using data. Any call that manipulates the Cursor or needs data that suggests the totally performed (e.g., getCount()) will really execute the query. Hence, it is advisable to "touch" the Cursor in doInBackground() when you are around the background thread.

From there forward, though, the whole result set is within memory, for result sets under 1MB.