So, if I want to e.g. replace Fragment, I can do the following:
ft.replace(R.id.frame, newFragment);
if (mFragmentManager.isStateSaved()) {
ft.commitAllowingStateLoss();
} else {
ft.commit();
}
The above code will not throw the notorious IllegalStateException
if it's run after the state is saved.
However, when it comes to popping the backstack, I can't find an analogously safe way of doing things.
So, is there any safe way to pop FragmentManager
's backstack after the state had already been saved?