EditText is losing users' input when rotating android phone

后端 未结 2 900
孤独总比滥情好
孤独总比滥情好 2020-12-16 08:14

PROBLEM

  • When a user types into the editText (landscape mode, or portrait) and rotates the phone the text is lost.

QUEST

相关标签:
2条回答
  • 2020-12-16 08:56

    I'm not positive, but almost, that when the orientation changes the activity is completely recreated is it not? You would have to use bundle to save instance states and such, check out this discussion about roughly the same topic and I'm sure you'll figure it out! Cheers!

    0 讨论(0)
  • 2020-12-16 08:59

    add

    android:configChanges="orientation"

    to your activity in the androidmanifest.xml. This will rotate the orientation but make no changes occur on orientation change.

    <activity android:name=".activityname"
    android:label="@string/app_name"
    android:configChanges="orientation">
    
    0 讨论(0)
提交回复
热议问题