Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

New Developer
Posts: 14
Registered: ‎02-13-2012
My Device: Blackberry Curve 8520
My Carrier: O2

android:screenOrientation causes app crash



Has anybody else experienced this problem:  when I specify android:screenOrientation="portrait" in my manifest, the app crashes on startup, both in the simulator and on a real device (it works fine an an Android device).  If I remove the orientation restriction it works fine (except that I wanted to force portrait)


I can't find anything else on it on the forums or on the net



Posts: 29
Registered: ‎03-06-2012
My Device: Developer

Re: android:screenOrientation causes app crash

You say it works fine without, now change orientation to landscape and portrait manually, does it crash?


What I mean is:

1. You said it crashes when you force portrait.

2. It does not crash when you do not force portrait. But what happens when you change orientation? Use your emulator to change orientation and see if it crashes. By emulator I mean the Android emulator since I am not sure if the PB emulator will let you change orientation. To change orientation by rotating the screen in Android emulator push the 7 and 9 key on the numpad on your keyboard.


Let us know if it crashes as well.

New Developer
Posts: 14
Registered: ‎02-13-2012
My Device: Blackberry Curve 8520
My Carrier: O2

Re: android:screenOrientation causes app crash



It doesn't crash without the orientation forced even if the orientation is changed.  It only seem to apply to forcing the orientation.  Possibly only forcing it into portrait, I haven't yet tried forcing landscape


On an Android device (including the Android emulator) forcing the orientation works fine



New Member
Posts: 1
Registered: ‎06-30-2014
My Device: BlackBerry Z10
My Carrier: Developer

Re: android:screenOrientation causes app crash

I'm getting the same issue. It happens when forcing portrait or landscape orientation.


For me it only seems to happen when forcing the orientation that the device isn't currently in, i.e. forcing portrait when holding the device in landscape position and vice versa.


Here is a device log:


I/ActivityManager(8777927): Config changes=1480 {1.0 ?mcc?mnc en_US ldltr sw384dp w384dp h590dp 320dpi nrml long port finger -keyb/v/h -nav/h s.59}
E/ActivityManager(8777927): Activity Manager Crash
E/ActivityManager(8777927): java.lang.NullPointerException
E/ActivityManager(8777927): at com.android.server.am.ActivityStack.resumeTopActivityLocked(ActivityStack.java:1442)
E/ActivityManager(8777927): at com.android.server.am.ActivityStack.resumeTopActivityLocked(ActivityStack.java:1420)
E/ActivityManager(8777927): at com.android.server.am.ActivityStack.completePauseLocked(ActivityStack.java:1161)
E/ActivityManager(8777927): at com.android.server.am.ActivityStack.activityPaused(ActivityStack.java:1059)
E/ActivityManager(8777927): at com.android.server.am.ActivityManagerService.activityPaused(ActivityManagerService.java:4627)
E/ActivityManager(8777927): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:418)
E/ActivityManager(8777927): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1719)
E/ActivityManager(8777927): at android.os.Binder.execTransact(Binder.java:351)
E/ActivityManager(8777927): at dalvik.system.NativeStart.run(Native Method)
W/dalvikvm(17141805): threadid=1: thread exiting with uncaught exception (group=7940ea08)
E/AndroidRuntime(17141805): FATAL EXCEPTION: main
E/AndroidRuntime(17141805): java.lang.NullPointerException
E/AndroidRuntime(17141805): at android.os.Parcel.readException(Parcel.java:1431)
E/AndroidRuntime(17141805): at android.os.Parcel.readException(Parcel.java:1379)
E/AndroidRuntime(17141805): at android.app.ActivityManagerProxy.activityPaused(ActivityManagerNative.java:2241)
E/AndroidRuntime(17141805): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2965)
E/AndroidRuntime(17141805): at android.app.ActivityThread.access$800(ActivityThread.java:141)
E/AndroidRuntime(17141805): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1245)
E/AndroidRuntime(17141805): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(17141805): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(17141805): at android.app.ActivityThread.main(ActivityThread.java:5056)
E/AndroidRuntime(17141805): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17141805): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(17141805): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
E/AndroidRuntime(17141805): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
E/AndroidRuntime(17141805): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(8777927): Force finishing activity com.aramptest.coordination/.UxmlActivity