As a followup, I have now found at least 3 ways do determine the orientation, all of which use different constants with different values.
* There is the aforementioned Activity.getRequestedOrientation which uses the ActivityInfo constants wherein landscape=0 and portrait=1 * Then there is getResources().getConfiguration().orientation which uses the Configuration constants wherein landscape=2 and portrait=1 * Then there is getWindow().getWindowManager().getDefaultDisplay().getOrientation(). I am not sure what constants this is using, but it returns exactly the opposite of the first: landscape=1 and portrait=0 There are probably more. Does anyone know the correct or preferred method? On Oct 23, 12:40 pm, ksmith44 <[EMAIL PROTECTED]> wrote: > How can you determine the current orientation? Most of my pages > rotate just fine, but I have one page on which I actually need to do > slightly different logic based on the orientation (specifically, I > want to add additional menu options in landscape mode). When I use > getRequestedOrientation(), I always get back a -1 (UNSPECIFIED). It > appears as if this method only works if an orientation has been > requested by the code using setRequestedOrientation. Is there a > better way to determine the current orientation? > > BTW, thanks hackbod for the gem about ctrl-F12. I never found that in > the documentation and had been changing the android:screenOrientation > var in my manifest file and restarting every time I wanted to test in > the alternate orientation. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

