IllegalStateException:在使用ViewPager的onSaveInstanceState之后无法执行此操作我在市场上从我的应用程序中得到用户报告,提供了以下例外:java.lang.IllegalStateException: Can not perform this action after onSaveInstanceStateat android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1109)at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:399)at android.app.Activity.onBackPressed(Activity.java:2066)at android.app.Activity.onKeyUp(Activity.java:2044)at android.view.KeyEvent.dispatch(KeyEvent.java:2529)at android.app.Activity.dispatchKeyEvent(Activity.java:2274)at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1855)at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1277)at android.app.Activity.dispatchKeyEvent(Activity.java:2269)at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.widget.TabHost.dispatchKeyEvent(TabHost.java:297)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)显然,这与FragmentManager有关,我不使用它。堆栈跟踪没有显示任何我自己的类,所以我不知道这个异常发生在哪里,也不知道如何防止它。记录在案:我有一个表主机,在每个选项卡中都有一个ActivityGroup在活动之间切换。
3 回答
慕标琳琳
TA贡献1830条经验 获得超9个赞
@Overrideprotected void onSaveInstanceState(Bundle outState) { //No call for super(). Bug on API Level > 11.}
super()
saveInstanceState
outState
Bundle
@Overrideprotected void onSaveInstanceState(Bundle outState) { outState.putString("WORKAROUND_FOR_BUG_19917_KEY", "WORKAROUND_FOR_BUG_19917_VALUE"); super.onSaveInstanceState(outState);}
transaction.commitAllowingStateLoss();
FragmentTransaction
Exception
.
- 3 回答
- 0 关注
- 381 浏览
添加回答
举报
0/150
提交
取消