title: orientation lock in android programmatically
body: <p>I have the following code.</p>
  
  <p>Java</p>
  
  <pre><code>public void lockScreenOrientation() {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
  }
  
  public void unlockScreenOrientation() {
       setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
  }
  </code></pre>
  
  <p>I am calling these functions from javascript. Control is entering these methods. However the orientation is not locked.</p>
  
  <p>I have tried following to lock the orientation</p>
  
  <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
  </code></pre>
  
  <p>None of these seem to work. Any pointers would be helpful.</p>