How to force the screen orientation to portrait before starting an App?
<p>I am using the following line of code for each of my activities in order to force the screen orientation to portrait mode:</p>

<pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
</code></pre>

<p>It works ok unless I put the device in landscape mode <strong>before</strong> launching the app. In this case, the activity closes suddenly.</p>

<p>Any idea on how to manage this case?</p>
