Thanks Sarwar for your answer. But when I put this code into the
onStart method. The orientation will always be Portrait.
When I discard the if-part, I am getting the same problem as mentioned
above. I realized now that, when the app enters the onStart the
orientation is initally -1(thats why I get the portrait-orientation
with the if-part). When the setrequestedorientation is called the
orientation is 0 (LANDSCAPE), as I requested. And then it is in this
infinite loop and when its now entering the onstart the
requestedorientation is 1 (PORTRAIT). Which is really weird to me.
Should I do anything in the TabActivity!? Any suggestions are very
welcome.
Thanks

On Jul 29, 10:46 am, Sarwar Erfan <[email protected]> wrote:
> 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