Using compat lib v1 (not using v2|3 because of certain bugs); a variation of this question.
I have a fragment whose UI has various controls whose state I want to maintain on an orientation change.
The parent activity is being destroyed on orientation change (PLEASE don't tell me about manifest changes to avoid activity recreation!!!!).
The fragment calls setRetainInstance(true)
.
1) Now my understanding is that Views with unique IDs should retain some state on say an orientation change. Given this I would expect a non-null bundle into onCreateView|onActivityCreated
but it is null.
2) In any case if I save state in onSaveInstanceState
(ensuring I call super) I still get a null bundle in 'onCreateView|onActivityCreated`
3) If I don't call setRetainInstance(true)
then I DO get a non-null bundle in onCreateView|onActivityCreated
even if I don't have an `onSaveInstanceState' method.
The questions I have is, is this working as expected and my understanding of the life-cycle is broken? Regardless, I'm guessing that the best way forward for me would be to retain the fragment and then maintain the state of the controls myself within the fragment.
Thanks in advance. Peter.