Skip to content Skip to sidebar Skip to footer

Android Android.database.staledataexception

I've updated my device to Android ICS (4.0.3) I have an activity which contains a list view filled in with data read from a database. The data are arranged in the listview using an

Solution 1:

I've found the cause and the solution is following: Just avoid Activity.managedQuery(...) and Activity.startManagingCursor(...) when you have to deal with Cursor or Database. The documentation says they are deprecated indeed.

Solution 2:

Instead of using Activity.ManagedQuery() use the Context.Query()

string[] projection = newstring[] { CalendarContract.Calendars.InterfaceConsts.Id };
        string selection = CalendarContract.Calendars.InterfaceConsts.Id + "=?";
        string[] selectionArgs =newstring[]{Constants.CALENDAR_ID.ToString()};
        var cursor = m_ContentResolver.Query(calendarUri, projection, selection, selectionArgs, null);

Example from Xamarin App, Calendar manipulation

Solution 3:

Use

Activity.getContentResolver().query() 

instead of

Activity.managedQuery()

Post a Comment for "Android Android.database.staledataexception"