Isaac Wagner wrote:
> On Sun, Apr 18, 2010 at 3:25 PM, Justin Giles <jtgi...@gmail.com> wrote:
>> Why would you want to allow them to set it in settings when Android handles
>> the rotation automagically?  All you have to do is have a xml file in your
>> "layout" directory, then for landscape have a xml file (with the same name)
>> in your "layout-land" directory.  When in portrait mode Android looks to the
>> "layout" directory.  When the phone is flipped to its side for landscape,
>> Android looks to the "layout-land" directory.
>> Justin
>>
> 
> <sigh> why is it that when I ask a simple question I get harassed? 

This discussion list gets a lot of people asking questions where they
are barking up the wrong tree. It is commonplace to inquire about their
rationale for barking up that tree and steer them in the direction of
more common patterns. Sometimes, the barking is indeed up the correct
tree, but that may not always be obvious from the question.

If you consider that to be harassment, you may wish to choose a
different means of getting Android developer support.

> OK, since it appears I can't get a simple answer without a long
> explanation.... My application is one such that the user moves their
> phone around a lot.  During this movement I want to keep the
> orientation constant -- I DON'T WANT ANDROID TO HANDLE THE ROTATION.
> So, in my manifest I set the orientation to portrait to prevent
> Android from mucking with the orientation.  However, I am now making
> some additions and would like the user to be able to choose portrait
> or landscape mode, but whatever they choose needs to stick.  Again, I
> don't want Android to handle the rotation.  As the phone is moved
> around I want whichever orientation they chose to stick.
> 
> Does that make sense?  Now, how do I do this?  How do I force the
> orientation to my preference?

You can try the combination of setRequestedOrientation() in onCreate()
(and from the menu or wherever the user chooses their preference) and
android:configChanges="keyboardHidden|orientation" in your manifest. I
have not used setRequestedOrientation() personally.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in NYC: 30 April-2 May 2010: http://guruloft.com

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to