在有Fragment的Activity中开启Activity出现下面这个Exception:
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1343)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1354)
at android.support.v4.app.BackStackRecord.com
......
这个exception的解决方法
1、重写onSaveInstanceState方法不,不执行 super.onSaveInstanceState(outState);
@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO Auto-generated method stub
// super.onSaveInstanceState(outState);
}
2、启动activity的时候放在hander.post(runnable)的 runnable 中执行
时间: 2024-11-02 02:45:27