简体   繁体   English

android-当我转动手机,mediaPlayer和应用程序停止时,我改变了视角

[英]android - I change the perspective when I turn my phone, my mediaPlayer and application stoping

I created an application for playing media file, it's work fine. 我创建了一个播放媒体文件的应用程序,一切正常。 but I change the perspective when I turn my phone, my application stoping. 但是当我转动手机时,我改变了视角,我的应用程序停止了。

When you change orientation, Android will re-create the Activity. 当您更改方向时,Android将重新创建活动。 So, you'll need to specifically handle the orientation change by overriding the onConfigurationChanged method of your Activity. 因此,您将需要通过覆盖Activity的onConfigurationChanged方法来专门处理方向更改。

@Override
public void onConfigurationChanged(Configuration newConfig) {
   // your code here.
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我的应用程序在Android中运行时,如何打开Wifi? - How can I turn Wifi on when my application runs in Android? 我可以制作一个Android应用程序,以便在用户超过一定期限后自动关闭我的手机吗? - Can I make an android application that should turn my phone off automatically when the user has passed a certain deadline? android 设备显示“我的应用程序不断停止” - android device showing “My application keeps stoping ” 当我离开我的应用程序时如何停止 MediaPlayer,但当我移动到另一个 Activity (Android Studio) 时不能 - How can I stop MediaPlayer when I leave my application, but not when I move to another Activity (Android Studio) android canvas打开我的手机时崩溃 - android canvas when on turn my phone it crash 当我从 Android Studio 在我的 Android 手机上运行我的应用程序时,它显示空白屏幕 - When I run my application on my Android Phone from Android Studio, it shows blank screen 为什么我在手机上看不到已安装的android应用程序? - Why i can not see my installed android application on my phone? 我已经在android中创建了自己的mediaplayer - I have created my own mediaplayer in android 安装后,我的android应用程序没有出现在手机上 - my android application doesn't appear on my phone when I installed it Android应用程序-选择值时,微调框的宽度发生变化 - Android Application - The width of my spinners change when I select a value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM