[英]Android Screen Orientation
I am using both landscape and portrait for an application. 我正在使用横向和纵向应用程序。
My problem is,whenever i rotate the screen,the TTS I am using in my application automatically 我的问题是,每当旋转屏幕时,我在应用程序中使用的TTS就会自动
starts from first. 从第一开始。
How do I solve this problem?
By default, Android restarts/recreates the activities whenever the orientation change. 默认情况下,Android会在方向更改时重新启动/重新创建活动。
You will need to save your data/state
by calling onSaveInstanceState()
before Android destroys the activities. 在Android销毁活动之前,您需要通过调用
onSaveInstanceState()
保存data/state
。
Have a look at Handling Runtime Changes 看看处理运行时更改
As the last resort, you could prevent this by adding android:configChanges="orientation"
to your activity in AndroidManifest file. 作为最后的手段,您可以通过在AndroidManifest文件中的活动中添加
android:configChanges="orientation"
来防止这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.