Reputation: 5495
I'm working at a game, and the orientation is sensorLandscape.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/GdxTheme" >
<activity
android:name="com.fainosag.marioskate.android.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="sensorLandscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Now my game can flip when I rotate my phone. THe problem i have is that when the phone is flipped, the accelerometer value is also flipped..
How can I find out which android landscape orientation is ?
Upvotes: 0
Views: 1392
Reputation: 106
I can't comment because of low rep. (previous was just converted to comment)
So now I know what you want, I didn't understand you before. Try this:
WindowManager mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Display display = mWindowManager.getDefaultDisplay();
int rotation = display.getRotation();
Check the degree with Surface.ROTATION_0
(no rotation), Surface.ROTATION_90
, Surface.ROTATION_180
, or Surface.ROTATION_270
.
See also here: http://developer.android.com/reference/android/view/Display.html#getRotation() and here http://developer.android.com/reference/android/view/Surface.html
Upvotes: 3