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
freezesText
totrue
in the xml layout for theEditText
to 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 theEditText
was null at that point.I tried setting
saveEnabled
to true in the xml layout for theEditText
which also didn't work.
What am I doing wrong?