Closed anuragdalia closed 6 years ago
I'm experiencing this same issue with 2.4.0, except only with root fragments. Keeps recreating the view (calling onCreateView in the fragment) even when the fragment itself is not null (I can see variables still persisted from the last time I had the fragment in focus).
Any solutions?
I'm experiencing this same issue with 2.4.0
This is intentional Android behavior. https://developer.android.com/guide/components/fragments.html#Lifecycle http://daniel-codes.blogspot.com/2012/06/fragment-transactions-reference.html https://inthecheesefactory.com/blog/fragment-state-saving-best-practices/en
The sample app in the repo has been updated with a checkbox and an edit text field, you can see that if you modify those, and return to the fragment either via switching back to it from a tab, or by pushing a fragment on top of it, and then returning, the state is correctly restored. Any other state that you need to restore is well outside the scope of this library, I can suggest https://github.com/frankiesardo/icepick
So i just implemented your fragnav library it seems to work the way it should with just one issue the fragment thats immediately before the current fragment seems to be recreated when i pop the current fragment. Is this how its intended to work? I can add code samples if you want.