It may just be a duplicate of another question, I'm just trying to figure out what to look for.
My camera application is blocked in landscape mode (in the manifest) as follows:
android:screenOrientation="landscape"
However, I still want to rotate some user interface elements when the device rotates into a portrait (although the android will still think about it in the landscape, but itβs on purpose).
So I tried this to check the orientation
int rotation = this.getWindowManager().getDefaultDisplay() .getRotation(); int degrees = 0; switch (rotation) { case Surface.ROTATION_0: Log.d("Rotation", "0"); break; case Surface.ROTATION_90: Log.d("Rotation", "90"); break; case Surface.ROTATION_180: Log.d("Rotation", "180"); break; case Surface.ROTATION_270: Log.d("Rotation", "270"); break; }
And, unfortunately, it always returns 90, regardless of how I rotate the phone. Is there a more reliable way to get orientation, no matter what Android thinks about orientation?
Jameo
source share