Reputation: 10363
When rotating an Android device into Landscape mode, it can be in 2 different positions, from the device's perspective, the bottom buttons could be either on the left or on the right. Is there a way to differentiate between these 2 modes? Either via onConfigurationChanged or via View.onSizeChanged I get the same result (obviously) as the device is on Landscape and the resolution is the same (800x480 in my case) for both "modes".
Thanks
Upvotes: 3
Views: 340
Reputation: 16622
This will get the screen orientation:
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int orientation = display.getRotation();
Then you can check it like this:
if(orientation == Surface.ROTATION_90) {
// do something
} else if (orientation == Surface.ROTATION_270) {
// do something else
}
Upvotes: 8