I want to force one special activity of my project (target sdk 17-19) to be displayed in portrait mode.
To that effect, I placed:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
in theonCreate
event of my class,- and
android:configChanges="orientation|screenSize"
in the activity section of myAndroidManifest.xml
.
This works fine with my emulator.
I have to do it programmatically, because the user should decide which orientation should be used for this single activity.
On my target device (HP Slate 21, Android 4.2.2, no sensor available) my activity is displayed in portrait mode without rotating the screen, which means there are black bars on the left and right side of my view, though the device is still in landscape mode.
The device is in landscape, but the view is in portrait. In the emulator, the device is in landscape, and the view is in landscape. What could be the reason?