Why am I getting a crash when exiting my Activity?

前端 未结 3 1841
终归单人心
终归单人心 2020-12-20 16:12

I am experiencing a crash in my app when I quit (via the back button) out of my Activity. So far as I can tell this is happening in the Android codebase and not mine, but I\

相关标签:
3条回答
  • 2020-12-20 16:41

    In your Activity before startManagingCursor() method is called , your Cursor is null. Dont let the Cursor be null.

    0 讨论(0)
  • 2020-12-20 16:43

    Excellent explanation of what's going on inside during this situation: http://www.jjoe64.com/2011/06/how-to-fix-activityperformstop.html

    0 讨论(0)
  • 2020-12-20 16:44

    Can't help much, as there's no code. Still looking at

    Caused by: java.lang.NullPointerException at android.app.Activity.performStop(Activity.java:3575)

    I just checked Activity.java

           final int N = mManagedCursors.size();
            for (int i=0; i<N; i++) {
                ManagedCursor mc = mManagedCursors.get(i); 
                if (!mc.mReleased) {
                    mc.mCursor.deactivate(); // line 3575
                    mc.mReleased = true;
                }
            }
    

    Are you sure all cursors are released properly?

    0 讨论(0)
提交回复
热议问题