title: Force "portrait" orientation mode
body: <p>I'm trying to force the "portrait" mode for my application because my application is absolutely not designed for the "landscape" mode.</p>
  
  <p>After reading some forums, I added these lines in my manifest file:</p>
  
  <pre><code>&lt;application 
    android:debuggable="true"
    android:icon="@drawable/icon" 
    android:label="@string/app_name"
    android:screenOrientation="portrait"&gt;
  </code></pre>
  
  <p>But it doesn't work on my device (HTC Desire). It switches from "portrait" lo "landscape", ignoring the lines from the manifest file.</p>
  
  <p>After more forums reading, I tried to add this in my manifest file:</p>
  
  <pre><code>&lt;application 
    android:debuggable="true"
    android:icon="@drawable/icon" 
    android:label="@string/app_name"
    android:configChanges="orientation"       
    android:screenOrientation="portrait"&gt;
  </code></pre>
  
  <p>and this function in my activity class:</p>
  
  <pre><code>public void onConfigurationChanged(Configuration newConfig)
  {
      super.onConfigurationChanged(newConfig);
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  }
  </code></pre>
  
  <p>But again, no luck.</p>