My application is music related and I am using Android 4.2.2. I blocked my application in landscape mode, indicating a line below in each of my actions:
android:screenOrientation="landscape"
Now that I keep the Music app open in landscape mode, lock the device’s screen with the keys, rotate the device in portrait mode, and then unlock the device’s screen so that My Music app throws an Exception.
I tried several solutions, for example, installed configChanges in my manifest
android:configChanges="keyboardHidden|orientation|screenSize"
But nothing works. I place the exception stack trace here. Please help me in this matter.
Note. Saving a music application in landscape mode, locking the device and unlocking it will not bring anything to the application. The application works as before, and also displays the activity open before locking the device.
What I want to do: I want to lock my application (only my application, not the whole device) in landscape mode and at the same time not listen to any changes in the orientation of the device.
Thanks!
Stacktrace:
E/AndroidRuntime(17468): FATAL EXCEPTION: main E/AndroidRuntime(17468): java.lang.RuntimeException: Unable to start activity ComponentInfo com.android.music/com.android.music.MediaPlaybackActivity}: java.lang.NullPointerException E/AndroidRuntime(17468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) E/AndroidRuntime(17468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/AndroidRuntime(17468): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3692) E/AndroidRuntime(17468): at android.app.ActivityThread.access$700(ActivityThread.java:141) E/AndroidRuntime(17468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1240) E/AndroidRuntime(17468): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(17468): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(17468): at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime(17468): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(17468): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(17468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(17468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(17468): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(17468): Caused by: java.lang.NullPointerException E/AndroidRuntime(17468): at com.android.music.MediaPlaybackActivity.onCreate(MediaPlaybackActivity.java:232) E/AndroidRuntime(17468): at android.app.Activity.performCreate(Activity.java:5104) E/AndroidRuntime(17468): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) E/AndroidRuntime(17468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) E/AndroidRuntime(17468): ... 12 more
source share