问题
My problem is generally described in this question: Once for all, how to correctly save instance state of Fragments in back stack?
But i can't understand how the accepted answer is related to it.
To keep it short:
There are 2 fragments A and B.
I go from A to B using transaction.replace() and add transaction to backstack.
I rotate screen -> fragment A is not visible, but it's onSaveInstanceState is called - everything ok up to this point.
I rotate screen again. Again A's onSaveInstanceState is called, but now it's view doesn't exist so I can't save it's state.
What's the purpose of using getFragment/putFragment, as accepted answer suggests? When my fragment is in the backstack there's no point in keeping reference to it I guess. Thanks.
来源:https://stackoverflow.com/questions/27062056/save-state-of-fragments-in-backstack