I have an activity which extends an AlertActivity. In that I am trying to play an audio file. When orientation changes audio goes stop. I want to continue playing audio even if the orientation changes. How can I prevent calling onPause and onStop when orientation changes? Please help
转到清单并将其添加到您的活动中android:configChanges =“ orientation | screenSize | keyboardHidden”
Try this Code : Add in Manifest File
<activity android:name=".Activity_name"
android:configChanges="orientation|keyboardHidden|screenSize"
you did not mention are you using fragments. this code may help you
android:configChanges="orientation|keyboardHidden|screenSize"
and also see this link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.