0

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();
                            }
                        }
                    }
                }
            }
        });
anshika
  • 121
  • 1
  • 6
  • 2
    A(n) (in)famous error state. See https://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html for details on why this occurs and what can be done about it. – Cheticamp Feb 27 '18 at 20:42
  • @Cheticamp,thanks lot – anshika Feb 27 '18 at 22:06
  • I did use commiAllowLossState but still whenever I am doing popbackstack getting this exception. – anshika Feb 28 '18 at 15:28

0 Answers0