I have a cursor adapter and the logcat is filled with above errors, as soon as I click on a view. I am already releasing the CursorAdapter's cursor in onDestroy().
Is there any way to get information about when the cursor was opened?
I have a cursor adapter and the logcat is filled with above errors, as soon as I click on a view. I am already releasing the CursorAdapter's cursor in onDestroy().
Is there any way to get information about when the cursor was opened?
Use startManagingCursor(cursor) instead of the onDestroy() option - this is much cleaner and better.
You should use startManagingCursor(c)
in your ListActivity right after you initialized your Cursor. Than the activity will handle the cursor and you don't have to care about it.
I was looking for the same thing and poked around the SDK.
The cursor finalizer looks if some debug properties are set and prints out the whole stacktrace if requested. They can be found in SQLiteDebug.java in the Android sourcecode.
/**
* Controls the stack trace reporting of active cursors being
* finalized.
*/
public static final boolean DEBUG_ACTIVE_CURSOR_FINALIZATION =
Log.isLoggable("SQLiteCursorClosing", Log.VERBOSE);
Just set the property (with adb shell) log.tag.SQLiteCursorClosing and check logcat again.
setprop log.tag.SQLiteCursorClosing Log.VERBOSE
This might only work in Froyo and above, I did not check the source for the older SDKs.