Can not perform this action after onSaveInstanceState on super.onBackPressed() Can not perform this action after onSaveInstanceState on super.onBackPressed() android android

Can not perform this action after onSaveInstanceState on super.onBackPressed()


You can't call onBackPressed() when your activity is paused. However, the behavior on a back press is to leave the activity. Just call finish() instead of onBackPressed().

You should make sure in your onBackPressed()'s override that the activity is going to finish. Back can be pressed for other reasons.


You can see the stack trace showing that the error is caused by FragmentManagerImpl.popBackStackImmediate.

This is just similar to onActivityResult, seems when you show the interstitial ad, you activity is put into pause, and when onAdClosed(), your app is not yet resumed.

To solve that, you can try to set a flag in onAdClosed(), and call onBackPressed() in onResume() if the flag is on.