icepick+dialogfragment=no state saved?
Closed this issue · 1 comments
oradkovsky commented
Hi. I am using icepick extensively. What I've faced recently is something I cannot understand - it's either misuse on my end or bug of icepick. Context:
- Got base abstract class that inherits from DialogFragment and has Icepick.saveInstanceState call in onSaveInstanceState as well as Icepick.restoreInstanceState in onCreateView.
- Got concrete dialog class that inherits from the above abstract class
- Got something like "@State String mName;" in p.2
What I'm observing is that state (value of mName) is not saved when hosting activity and fragment gets killed. onSaveInstanceState (with Icepick.saveInstanceState) is called while activity/fragments are dying. onCreateView (with Icepick.restoreInstanceState) is called when activity gets recreated.
When I do something like "outState.putString("key", mName)" in onSaveInstanceState, and mName = savedInstanceState.getString("key") in onCreateView - it works perfectly.
frankiesardo commented
Closing this as stale issue