Alex Rivera | Logout

android screen orientation

Asked 2011-01-15T01:58:25.970
20

I tried getOrientation() to get the orientation value but it always returns 0!

Edit
Report

1 Answer

37

If you want to know if the content currently displayed is in landscape mode or portrait (possibly completely independent of the phone's physical rotation) you can use:

getResources().getConfiguration().orientation

Developer Documentation

public int orientation
Since: API Level 1

Overall orientation of the screen. May be one of ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, or ORIENTATION_SQUARE.

answered 2011-01-15T04:32:51.250

Your Answer