title: How do I get the CURRENT orientation (ActivityInfo.SCREEN_ORIENTATION_*) of an Android device?
body: <p>I would like to find out the detailed orientation of a device, preferably one of <code>SCREEN_ORIENTATION_LANDSCAPE</code>, <code>SCREEN_ORIENTATION_PORTRAIT</code>, <code>SCREEN_ORIENTATION_REVERSE_LANDSCAPE</code>, <code>SCREEN_ORIENTATION_REVERSE_PORTRAIT</code> from <code>ActivityInfo</code> or equivalent.</p>
  
  <p>Some of the answers here on StackOverflow included</p>
  
  <pre><code>getWindowManager().getDefaultDisplay().getRotation()
  </code></pre>
  
  <p>but this doesn't really tell me whether the device is in portrait or landscape mode, only how it's turned with reference to its natural position - which in turn can be landscape or portrait in the first place.</p>
  
  <pre><code>getResources().getConfiguration().orientation
  </code></pre>
  
  <p>returns one of the following three: <code>ORIENTATION_LANDSCAPE</code>, <code>ORIENTATION_PORTRAIT</code>, <code>ORIENTATION_SQUARE</code>, which then doesn't really tell me which way the phone is turned (whether it's upside down or which of the sides it's turned to).</p>
  
  <p>I know I could use the latter in combination with <code>DisplayMetrics</code> to find out the device's natural orientation, but is there really no better way?</p>