Hi,
Good day.

Change the orientation (call setRequestedOrientation) inside
overridden method of onStart, NOT inside onCreate. (do it in both
Activity1 and Activity2)

Regards
Sarwar Erfan


On Jul 29, 2:25 pm, Robert <[email protected]> wrote:
> Hello,
> I have a tabactivity where my app is running in. One of the tabs needs
> to have landscape orientation, assume this is activity2, activity1
> needs to have portrait-orientation.
>
> In activity1 I do have code like:
>
> public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         if(this.getRequestedOrientation() ==
> ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
>
> this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
>
> }
>
> And in activity2:
>
> public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         if(this.getRequestedOrientation() ==
> ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
>
> this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
>
> }
>
> So when I now want to change from activity1 to activity2. It seems as
> my app is in a infinite-loop, it tries to start activity2 again and
> again, but it doesnt appear. I dont get an exception either!
>
> Is that some know bug of android or am I doing something wrong. Help a
> appreciated a lot.
>
> Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to