I don't know what you mean by "turn the view."  When the orientation
changes to switch from the dominant to secondary orientation (portrait
to landscape on the g1), the graphics of the entire screen are rotated
to result in the screen being shown in the new orientation.  As such,
there is no need to do anything yourself, at it looks like to the
application is that the size of the screen has changed to match the
new orientation.

For different resources, normally you also don't need to do anything,
because when the orientation changes the current activity is destroyed
and a new one started, and the new one is running with a configuration
matching the new orientation so will load the appropriate resources as
it creates and initializes itself.

The only except is if you are using android:configChanges to avoid
being restarted due to a configuration change...  which is one of the
reasons why it is strongly encouraged not to do this, and certainly if
you are changing layouts due to the orientation I would really suggest
letting the normal destroy/recreate path execute.  If you really
really do want to mix the two, you will need to override
onConfigurationChanged() and re-inflate your view hierarchy and re-
initialize anything else depending on that or changing resources at
that point.

On Oct 20, 5:19 am, Mark Hansen <[EMAIL PROTECTED]> wrote:
> I've actually created layouts for both vertical and horizontal views,
> I've had some people testing it and it turns out Android doesn't turn
> the view, I guess it has to be detected?
>
> I was curious how to go about doing that detection.. I know I can also
> set the view with:
>
> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_*);
>
> The problem I'm having is what event to trap or how to go about
> determining which way the phone is being held.
>
> On Oct 20, 12:13 am, hackbod <[EMAIL PROTECTED]> wrote:
>
> > Use the android:screenOrientation attribute when declaring your
> > manifest:
>
> >http://code.google.com/android/reference/android/R.styleable.html#And...
>
> >http://code.google.com/android/reference/android/R.styleable.html#And...
>
> > On Oct 19, 3:23 pm, Mark Hansen <[EMAIL PROTECTED]> wrote:
>
> > > I was thinking Android switched orientation automatically based on the
> > > phones position but I'm finding from users this is not the case.
>
> > > Anyone have some sample code on how to switch screen orientation based
> > > on the position of the phone?
>
> > > Thanks,
>
> > > Mark
--~--~---------~--~----~------------~-------~--~----~
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