Although the concept is very simple, I seem to be having difficulty saving the text value of a TextEdit when the orientation of the device changes. When I change the orientation, the text inside my EditText is erased.
The view hierarchy is as follows:
Activity
View Pager
Fragment
Recycler View
View Holder
Edit Text
I tried setting
freezesTexttotruein the xml layout for theEditTextto no avail.In the fragment, I tried saving the text in
onSaveInstanceState()and restoring inonActivityCreated(), but it seemed likeonSaveInstanceState()was never getting called.In the activity, I tried saving the text in
onSaveInstanceState()and restoring inonCreate(), but theEditTextwas null at that point.I tried setting
saveEnabledto true in the xml layout for theEditTextwhich also didn't work.
What am I doing wrong?