Created
October 27, 2017 04:23
-
-
Save bapspatil/2bf443e4d0af79893f6fa0faa174ec0c to your computer and use it in GitHub Desktop.
Check the orientation of the device (landscape or portrait)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** Created by bapspatil | |
*/ | |
// Checks if the device is in portrait mode or not | |
public boolean isDeviceInPortrait() { | |
// Use Configuration.ORIENTATION_LANDSCAPE if you want to check for landscape orientation | |
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) | |
return true; | |
else | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment