开发者

How can I prevent a re-start of my app when the phone is rotated?

开发者 https://www.devze.com 2023-04-03 22:09 出处:网络
In my app I don\'t want to restart a m开发者_高级运维edia player once it starts if the user rotates the phone. How can I prevent a re-start of my app when it is rotated because it stops the running so

In my app I don't want to restart a m开发者_高级运维edia player once it starts if the user rotates the phone. How can I prevent a re-start of my app when it is rotated because it stops the running sound file that is playing?

Please show me the code I need to add and where to add it.

Thanks.

Truly, Emad


use this

  <activity android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" android:name="VncCanvasActivity">

see this


You have to redesign your application to play the music from a service instead of from your main activity. Your main activity can at any time be killed by the operating system if it decides it needs memory.

See What is a service

0

精彩评论

暂无评论...
验证码 换一张
取 消