Save state of fragments in backstack
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.
链接地址: http://www.djcxy.com/p/58702.html上一篇: 片段替换后调用onSaveInstanceState
下一篇: 在堆栈中保存碎片状态