By Alvin Alexander. Last updated: June 6, 2016
Use this code to get the Android screen orientation:
// orientation (either ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT) int orientation = getResources().getConfiguration().orientation;
As shown in the comment, the resulting orientation will either be ORIENTATION_LANDSCAPE
or ORIENTATION_PORTRAIT
. See the Android docs for more information.