Caused by: android.database.StaleDataException: Attempted to access a cursor after it has been closed.
at android.database.BulkCursorToCursorAdaptor.throwIfCursorIsClosed(BulkCursorToCursorAdaptor.java:64)
at android.database.BulkCursorToCursorAdaptor.requery(BulkCursorToCursorAdaptor.java:133)
at android.database.CursorWrapper.requery(CursorWrapper.java:186)
at android.app.Activity.performRestart(Activity.java:5148)
at android.app.ActivityThread.performRestartActivity(ActivityThread.java:3214)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:168)
at android.app.LocalActivityManager.dispatchResume(LocalActivityManager.java:523)
at android.app.ActivityGroup.onResume(ActivityGroup.java:61)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
at android.app.Activity.performResume(Activity.java:5182)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
... 10 more
第二种,在游标关闭的时候对android sdk版本做个判断
- try
- {
-
- if(Integer.parseInt(Build.VERSION.SDK) < 14)
- {
- cursor.close();
- }
- }catch(Exception e)
- {
- Log.error(TAG, "error:" + e);
- }