测试同学跑Monkey跑出了这个异常导致的crash,对应的Android版本是Android6.0。
补充:出问题的Activity是使用了ViewPager无限循环展示图片,内容是ImageView,不是Fragment。
但是我的应用中没有用到任何Fragment,任何commit方法。详细Log如下:
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1438)
at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:581)
at android.app.Activity.onBackPressed(Activity.java:2537)
at android.app.Activity.onKeyUp(Activity.java:2511)
at android.view.KeyEvent.dispatch(KeyEvent.java:2695)
at android.app.Activity.dispatchKeyEvent(Activity.java:2764)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2384)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4687)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4643)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4155)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4208)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4320)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4182)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4377)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4155)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4208)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4182)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4155)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4208)
在StackOverFlow上搜到了类似的问题:http://stackoverflow.com/ques...
StackOverFlow上说要重写onSaveInstaceState方法,去掉super调用,但是我不清楚这样做是否存在负作用,所以希望有经验的人指导一下如何解决这个问题
相关分类