getting exception “IllegalStateException: Can not perform this action after onSaveInstanceState”

前端 未结 30 2055
迷失自我
迷失自我 2020-11-22 05:12

I have a Live Android application, and from market i have received following stack trace and i have no idea why its happening as its not happening in application code but it

30条回答
  •  孤独总比滥情好
    2020-11-22 05:50

    I had the same problem, getting IllegalStateException, but replacing all my calls to commit() with commitAllowingStateLoss() did not help.

    The culprit was a call to DialogFragment.show().

    I surround it with

    try {
        dialog.show(transaction, "blah blah");
    }
    catch(IllegalStateException e) {
        return;
    }
    

    and that did it. OK, I don't get to show the dialog, but in this case that was fine.

    It was the only place in my app where I first called FragmentManager.beginTransaction() but never called commit() so I did not find it when I looked for "commit()".

    The funny thing is, the user never leaves the app. Instead the killer was an AdMob interstitial ad showing up.

提交回复
热议问题