以下是我的堆栈跟踪:
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1511)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
这是我的代码:
dialog = FeedDialog.getInstance(feedViewModels, this, false, this);
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager != null && !isFinishing()) {
FragmentTransaction ft = fragmentManager.beginTransaction();
ft.add(R.id.fragment_content, dialog);
ft.addToBackStack("unread_feeds");
ft.commit();
fragmentManager.executePendingTransactions();
}
这里的对话框是一个包含视图寻呼机的片段。
这个问题只出现过一次。让我知道如何解决它。