Facing Difficulty While Setting Screen Orientation Of Activity At Run Time
<p>Hi Friends,<br>
I've an Activity, I want this to run in Portrait mode for <strong>240x320</strong>  and in landscape mode for <strong>320x240</strong>. so in Activity's onCreate() method i'm requesting for screen Orientation</p>

<pre><code>    protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);

           if(is320x240)
              setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 
           else
              setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 

}
</code></pre>

<p>my promblem is: When i launch this activity in 320x240 device, by holding the device in portrait mode, activity get existing automatically (activity appears fraction of second). But if i hold device in landscape mode while launching, it works fine. </p>

<p>What is the problem? and how can i launch the activity in landscape mode, even-though user holds the device in portrait mode? </p>

<p>Thanks in advance </p>
