Closed lupsyn closed 6 years ago
Hi @lupsyn
For me the sample app works properly: I have the followin: Tab Nearby : [NearbyFragment 0, NearbyFragment 1, NearbyFragment 2] Tab Friends : [FriendsFragment 0, FriendsFragment 1]
After rotation and going back on Tab Nearby I still see 1 and 0 (which essentially a state of that page also if I checked the "Example to show stored state" it is shown correctly.
Since fragmenttransaction attach and detach recreates the view obviously if you have some special view state you'll have to handle it manually in your fragment (onSaveInstanceState - save, onCreateView - restore)
All above applies to 3.0.0+ version
@mateherber thanks for the answer, maybe i miss something, is the text into the EditText consider part of the state ? Or maybe i misunderstood what a fragment state is...
@lupsyn In the sample nothing is persisted manually it just relies on the framework to save control's state. It seems edittext doesn't automatically persist its state to bundle however you could do that easily manually (and restore).
In the example app with the bottom nav with multiple stacks, in case of rotation, and in the case fragments are detached, the internal state of fragment is lost, is this the expected behaviour or I missing something? I mean :
tab 1 : [A,B,C] tab 2: [D,E]
We have custom state into A, and B we are displaying C (so A,B,D,E are detached but still present into fragment manager), we rotate (or we don't keep activities and we put the app in background) the state of A and B is lost. Is it something we can do to persist it ?