Issue
Activity A is a SingleTask activity. In its OnCreate callback I create and attach a fragment to the layout.
Activity B is now launched and A is paused and its OnSaveInstanceState is called.
Activity A is now re-invoked with a new intent (because of an interaction in B). In OnNewIntent() I create a new fragment based on the new intent and replace the previous fragment.
This leads to an IllegalStateException: Cannot perform this action after onSaveInstanceState.
What is the right way of doing this? It looks like the framework still considers A to be paused even though OnNewIntent() has been called.
Solution
You need to call super.onNewIntent(intent)
to update the FragmentManager's state such that you can do FragmentTransactions.
Answered By - ianhanniballake
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.