Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen is turned upside down

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?

like image 468
gabi906 Avatar asked Oct 05 '22 16:10

gabi906


1 Answers

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

like image 105
nilamber Avatar answered Oct 10 '22 02:10

nilamber