title: How do I detect screen rotation on android?
body: <p>i want to detect screen rotation via native. </p>
  
  <p>for a example, when touch event occured, we can detect via /dev/input/event* event device</p>
  
  <p>is this possible ? </p>
  
  <p>i mean, without using java. just use native method.</p>
  
  <pre><code>WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
  Display disp = wm.getDefaultDisplay();
  
  int rotation = disp.getRotation(); // Android 2.2
  Log.i( "Rotation", "rotation : " + rotation );
  
  switch ( rotation )
  {
      case Surface.ROTATION_0: 
          Log.i( "Roation", "Portrait : 0" ); 
          break;
  
      case Surface.ROTATION_90:
          Log.i( "Roation", "Landscape : 90" );
          break;
  
      case Surface.ROTATION_180:
          Log.i( "Roation", "Portrait : 180" );
          break;
  
      case Surface.ROTATION_270:
          Log.i( "Roation", "Landscape : 270" );
          break;
  }
  </code></pre>