Screen Android Landscape Portrait programmatically

Screen Android example source code for developers.
Get orientation of screen.

 public int getScreenOrientation() {
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)                {
       return 1; // Portrait Mode
 
  }else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
       return 2;   // Landscape mode
  }
  return 0;
 }
This entry was posted in Android Examples Code and tagged , , , , . Bookmark the permalink.


Comments are closed.



2,528 views