Android screen orientation to sensor
<p>I want to force the screen orientation to landscape on button click by setting setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);</p>

<p>It works fine. Now I want the application to follow the sensor so that orientation is brought back to portrait when tilted back to portrait. I know this is possible by setting setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); but don't know where to set it. If the orientation is forced to landscape, orientation will remain in landscape no matter you tilt in any direction. Can anyone specify how to reset the orientation flag?</p>
