Put the "android:screenOrientation="sensor"" as an attribute on each
activity in your manifest that you want to be sensor-oriented.

Works great!  Thx for the tip hackbod!

On Nov 18, 3:14 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Will this setting make the screen change to lanscape using the
> accelerometer? If so, where do I put this setting?
>
> Thanks
>
> On Oct 20, 5:37 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
>
>
> > Don't do that, or moving between your app and others will be flicker.
> > Just use android:screenOrientation="sensor".
>
> > On Oct 20, 12:47 pm, Tauno T <[EMAIL PROTECTED]> wrote:
>
> > > And that's why he want's to set the orientation programmatically - the
> > > users expect that when the phone is turned "sideways" then the picture
> > > is also turned sideways:) The user is not confused - he just thinks
> > > that Android has a feature that it does not have (sadly).
>
> > > As for the solution - Xolotl Lokis solution will works just fine - you
> > > only have to figure out which sensor reading corresponds to the phone
> > > being held sideways and then change the layout using
> > > setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_*);
>
> > > Tauno
>
> > > On Oct 20, 10:39 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > Your user is confused.  The standard orientation policy is to select
> > > > the orientation based on the keyboard: when the keyboard is closed it
> > > > is portrait, when open it islandscape.  Pressing Ctrl+F12 in the
> > > > emulator is exactly the same as sliding the keyboard out on the G1.
>
> > > > On Oct 20, 11:57 am, Mark Hansen <[EMAIL PROTECTED]> wrote:
>
> > > > > From what I was told by a user of my application, that it did not
> > > > > change view, even when the keyboard was opened for text entry.
>
> > > > > I've built two set's of layout files, and stored them in "layout" and
> > > > > "layout-land" for when the view changes.  In emulator mode they work
> > > > > fine, CTRL-F12 works fine.. but, and I may be misinformed here, it
> > > > > appears the actual phone itself is not rotating the screen based on
> > > > > the keyboard of position of the actual phone.
>
> > > > > He even stated many of the default Google application aren't rotating
> > > > > as well, and that very few actually change based on the way the device
> > > > > is being held.
>
> > > > > On Oct 20, 12:21 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > > > I don't know what you mean by "turn the view."  When the orientation
> > > > > > changes to switch from the dominant to secondary orientation 
> > > > > > (portrait
> > > > > > tolandscapeon 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 whateventto 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- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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