Reputation: 384
I am testing/debugging an Android app and even though i have set
configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
and used
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
the screen turns upside down. This seems to appear on WXGA 4.0, 4.1, 4.2. Is it something related to the API, emulator or something else? I am asking this question because I didn't find anything official and clear.
Thank you.
PS: as a solution, in case there's an API problem, should i check it's version and rotate the screen or is there something better?
Upvotes: 5
Views: 2316
Reputation: 371
HI I am using this for landscape
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" android:configChanges="orientation" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" android:configChanges="orientation" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
for portrait and its wrking for me android 4.1 simulator
Upvotes: 4