android - AppCompatActivity onDestroy calls Fragment's onCreateView? -
in app have mainactivity containing 2 fragments tabbed. somehow exception evolving mainactivity's ondestroy calling fragment's oncreateview.
i aware in fragment's lifecycle oncreateview should called after ondestroyview not after ondestroy.
i don't know how reproduce issue attached stack trace:
fatal exception: java.lang.runtimeexception: unable destroy activity {com.myapp.myapp/com.myapp.activities.mainactivity}: java.lang.nullpointerexception: attempt read field 'com.myapp.model.team com.myapp.model.user.team' on null object reference @ android.app.activitythread.performdestroyactivity(activitythread.java:4203) @ android.app.activitythread.handledestroyactivity(activitythread.java:4221) @ android.app.activitythread.-wrap6(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1538) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:154) @ android.app.activitythread.main(activitythread.java:6119) @ java.lang.reflect.method.invoke(method.java) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:886) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:776) caused java.lang.nullpointerexception: attempt read field 'com.myapp.model.team com.myapp.model.user.team' on null object reference @ com.myapp.adapters.activitieslistadapter.updateactivities(activitieslistadapter.java:130) @ com.myapp.adapters.activitieslistadapter.<init>(activitieslistadapter.java:125) @ com.myapp.fragements.feedfragment.oncreateview(feedfragment.java:110) @ android.support.v4.app.fragment.performcreateview(fragment.java:2189) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1299) @ android.support.v4.app.fragmentmanagerimpl.movefragmenttoexpectedstate(fragmentmanager.java:1528) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1595) @ android.support.v4.app.fragmentmanagerimpl.dispatchreallystop(fragmentmanager.java:2915) @ android.support.v4.app.fragmentcontroller.dispatchreallystop(fragmentcontroller.java:249) @ android.support.v4.app.fragmentactivity.onreallystop(fragmentactivity.java:816) @ android.support.v4.app.fragmentactivity.doreallystop(fragmentactivity.java:795) @ android.support.v4.app.fragmentactivity.ondestroy(fragmentactivity.java:388) @ android.support.v7.app.appcompatactivity.ondestroy(appcompatactivity.java:209) @ com.myapp.activities.mainactivity.ondestroy(mainactivity.java:772) @ android.app.activity.performdestroy(activity.java:6881) @ android.app.instrumentation.callactivityondestroy(instrumentation.java:1153) @ android.app.activitythread.performdestroyactivity(activitythread.java:4190) @ android.app.activitythread.handledestroyactivity(activitythread.java:4221) @ android.app.activitythread.-wrap6(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1538) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:154) @ android.app.activitythread.main(activitythread.java:6119) @ java.lang.reflect.method.invoke(method.java) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:886) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:776)
in end, oncreatview creating null pointer exception evolved code, don't want patch (if mmember != null) or something, want understand happens , why flow happens way.
thanks.
Comments
Post a Comment