سؤال

In my app I don't want to restart a media 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

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

use this

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

see this

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top