title: How can i detect orientation changes in portrait mode in android?
body: <p>I need to show a camera preview in my app so that the photos can be taken by pushing a button.
  So I put a pretty "standard" camera preview class.  The problem is I have to put it in landscape mode so that the preview can stretch on the entire screen. If in portrait mode, it will remain only on the center of the screen, on a small part of it. If this can be solved easier, I am open to suggestions.</p>
  
  <p>But my question is. If locked in landscape mode, how can i detect screen rotation so that i can rotate text of the button accordingly ?
  I tried </p>
  
  <pre><code>@Override
  public void onSensorChanged(SensorEvent event)
  {
      Log.d("onSensorChanged");
      Log.d("event:" + event);
  
  }
  </code></pre>
  
  <p>but I get no result.</p>