PROBLEM
- When a user types into the editText
(landscape mode, or portrait) and
rotates the phone the text is lost.
QUESTION
- How can I prevent the loss of the
text ?
underlying code:
- onCreate() ->
setContentView(myLayout) -> get
references to UI widgets with
findViewById() - onConfigurationChanged() -> setContentView(myLayout) -> get references to UI widgets with findViewById()
my guess is that the setContentView() within onConfigurationChanged() causes the data loss.
What I believe I need to do is grab the data from the EditText before this happens. But how ?
add
android:configChanges=”orientation”
to your activity in the androidmanifest.xml. This will rotate the orientation but make no changes occur on orientation change.