Find out if Android device is portrait or landscape for normal usage?
You can do this by:
For Lanscape
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
// Do some stuff
}
For Portrait
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
// Do some stuff
}
Check: Configuration.orientation
It's simple, Just a If-Else
block:
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
// landscape
} else {
// portrait
}