[英]Android saving text in TextView after orientation change
I've tried 100 things to solve this, but none of them seem to work for saving text in a TextView when my orientation changes. 我已经尝试了100件事来解决这个问题,但是当方向改变时,它们似乎都无法在TextView中保存文本。
On orientation change, none of these functions are ever called: 更改方向时,不会调用以下任何功能:
onRetainNonConfigurationInstance(),
onRestoreInstanceState(),
onSaveInstanceState()
Note that I have android:configChanges="orientation"
in my manifest for this activity so onConfigurationChanged()
is called instead of onCreate()
since I want onCreate()
to only run once. 请注意,我在清单中为此活动设置了
android:configChanges="orientation"
,因此onConfigurationChanged()
而不是onCreate()
因为我希望onCreate()
仅运行一次。
Anyone have any ideas at all to fix this? 任何人都没有任何想法来解决这个问题?
If you specify android:configChanges then all of this methods will not be called. 如果您指定android:configChanges,则不会调用所有这些方法。 See Activity ConfigurationChanges and Activity.onRetainNonConfigurationInstance() .
请参阅活动ConfigurationChanges和Activity.onRetainNonConfigurationInstance() 。 Only onConfigurationChanged() method will be called.
仅onConfigurationChanged()方法将被调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.