Can not perform this action after onSaveInstanceState Android

大憨熊 提交于 2019-12-11 14:07:52

问题


I am getting java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState . When I did fragmentManager.popBackStack(). This crash is random . I am not overriding onSaveInstanceState() in my activity.

       Navigator.post(new Runnable() {
            @Override
            public void run() {
                if (actRef != null && actRef.get() != null) {
                    if (isLastFragment()) {
                        finish();
                    } else {
                        if (fragMngr != null) {
                            try {
                                fragMngr.popBackStack();//crashing in this line
                                /**
                                 * check if it is last fragment
                                 */
                                if (isLastFragment()) {
                                    finish();
                                }
                            } catch (IllegalStateException ignored) {
                                ignored.printStackTrace();
                            }
                        }
                    }
                }
            }
        });

来源:https://stackoverflow.com/questions/49017470/can-not-perform-this-action-after-onsaveinstancestate-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!