[mono-android] android.database.StaleDataException OnResume

Jonathan Pryor jonp at xamarin.com
Wed Jan 4 13:44:26 EST 2012


On Dec 19, 2011, at 10:12 PM, riteshsahu wrote:
> Is this something wrong with Android 4.0.1 or something in M4A?

The true determination of that is by writing a similar Java app that does the "same" thing, and see if it behaves the same.

Based on that stack trace, I'd say it's an Android-ism (i.e. it'll impact both Java and C# equally), as android.app.Activity has a mManagedCursors field which is (somehow) referencing an invalid cursor. How? Why? I have no idea.

Did you call Activity.StartManagingCursor() by any chance?

Alternatively, are you explicitly closing the Cursor? From the docs: http://developer.android.com/reference/android/app/Activity.html#startManagingCursor(android.database.Cursor)

> Warning: Do not call close() on cursor obtained from managedQuery(Uri, String[], String, String[], String), because the activity will do that for you at the appropriate time. However, if you callstopManagingCursor(Cursor) on a cursor from a managed query, the system will not automatically close the cursor and, in that case, you must call close().

 - Jon



More information about the Monodroid mailing list