开发者

Android: Activity restarts on switch to landscape/keyboard flips out

When a user flips their keyboard out or switches between portrait and land开发者_运维技巧scape, the activity seemingly restarts. This is fine except I have my activity play music. When this occurs, there are then TWO music files playing, and pressing back only stops ONE of them! I've disabled switching between portrait and landscape for the activity, but sliding the keyboard out still causes the issue!


FIrstly, check out the android:configurationChanged attribute. Secondly, the music playing is usually done by the service or the AsyncTask in simple cases. Try this two approaches.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜