Equivalent of FragmentActvity.onResumeFragments() for (nested) Fragment

377 Views Asked by At

I'm trying to avoid this exception throughout my code, even though I've only seen it triggered by some of my code sometimes:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

As suggested by this blog post, I'm avoiding commit()ing any Fragment Transactions during my onLoadFinished() methods: http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html

I'd like to set a delayWhatever boolean in an onPause(), check for it in onLoadFinished() and then do the delayed work (committing the Transaction) when I know that the instance state has been restored.

That's fine when I'm in an Activity because I can do the delayed work in onResumeFragment(). But I have nested fragments (An Activity containing a Fragment containing 2 other Fragments). So where is it safe to commit transactions if my onLoadFinished() is in my Fragment, not the parent Activity()?

0

There are 0 best solutions below