java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

场景:ActivityA嵌套Fragment,点击按钮跳转到ActivityB, 在B 页面进行一些操作返回A页面时在onActivityResult() 中刷新fragment。

private void initFragment() {
        String ids = StringUtil.LongIds2str(mIds);
        if (fragment != null ) {
            fragment = new TopicListFragment().newInstance(ids);
            getSupportFragmentManager().beginTransaction().replace(R.id.fl_container, fragment).commitAllowingStateLoss();
        } else {
            fragment = new TopicListFragment().newInstance(ids);
            getSupportFragmentManager().beginTransaction().add(R.id.fl_container, fragment).commit();
        }
}

http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html

你可能感兴趣的:(java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState)