2015-11-10 43 views
2

崩潰低於片段機器人:爲什麼FragmentActivity.onDestroy叫onCreateView

at com.activity.upgrade.VersionFragment.parse(VersionFragment.java:73) 
at com.activity.upgrade.VersionFragment.onCreateView(VersionFragment.java:57) 
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789) 
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955) 
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138) 
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1120) 
at android.support.v4.app.FragmentManagerImpl.dispatchReallyStop(FragmentManager.java:1956) 
at android.support.v4.app.FragmentActivity.onReallyStop(FragmentActivity.java:790) 
at android.support.v4.app.FragmentActivity.doReallyStop(FragmentActivity.java:767) 
at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:314) 
at com.common.BaseActivity.onDestroy(BaseActivity.java:107) 
at android.app.Activity.performDestroy(Activity.java:5421) 
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117) 
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3494) 

奇怪的是,片段onCreatView不是從活動調用的onCreate但是從的onDestroy。這種情況發生在系統或某些第三方工具殺死應用程序後進入應用程序時。任何人都見過這個?

********** ********** UPDATE

從源代碼,似乎相關片段的狀態。當它的onDestroy中的FragmentActivity的狀態是Fragment.INITIALIZING或Fragment.CREATED狀態。我認爲它應該處於錯誤的狀態。

回答

0

看到here

堆棧跟蹤是好的,也許在的onDestroy或回調的onResume的問題。你應該在你的onResume方法中使用super.onResume或super.OnDestroy!

谷歌應用程序演示也投影生命週期調用必須首先調用子類的方法。 enter image description here

+1

是的,我已經遵循規則,在任何事情之前調用super.xxx,比如onPause,onDestroy。仍然遇到了這個問題:( – mianlaoshu