getResources().getConfiguration().orientation contains the current orientation, as defined by the constants described in the java docs (NOT the SCREEN_ORIENTATION_* contantgs).
On Mon, Apr 27, 2009 at 4:05 PM, [email protected] < [email protected]> wrote: > > I cant seem to get current orientation via either: > > getResources().getConfiguration().orientation > or > (WindowManager) getSystemService(WINDOW_SERVICE).getDefaultDisplay > ().getOrientation(); > > after setting up a preferred orientation via: > > setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); > > Is there something I am doing wrong here? Is there a different way to > access the current orientation of the phone? > > Thanks! > > On Mar 26, 9:50 am, Amir Alagic <[email protected]> wrote: > > int orientation = getResources().getConfiguration().orientation > > > > On Mar 25, 8:12 am, Dianne Hackborn <[email protected]> wrote: > > > > > Sorry I made a mistake, use getResources().getConfiguration(). > > > > > On Tue, Mar 24, 2009 at 10:43 PM, for android <[email protected]> > wrote: > > > > Does that mean from the DisplayMetrics we need to check from the > height and > > > > width? > > > > > > On Wed, Mar 25, 2009 at 10:55 AM, Dianne Hackborn < > [email protected]>wrote: > > > > > >> That returns the orientation mode your activity has requested. The > actual > > > >> current orientation is in getResources().getDisplayMetrics(). > > > > > >> On Tue, Mar 24, 2009 at 10:01 PM, for android <[email protected] > >wrote: > > > > > >>> getRequestedOrientation() > > > > > >>> On Wed, Mar 25, 2009 at 9:34 AM, Suman <[email protected]> > wrote: > > > > > >>>> Hi all............... > > > > > >>>> Thanks for replies. Can any one tell me by which > > > >>>> method i can check the screen orientation? I mean i want to check > > > >>>> whether it is land-scap mode or portrait mode. Thanks in advance. > > > > > >>>> Suman. > > > > > >> -- > > > >> Dianne Hackborn > > > >> Android framework engineer > > > >> [email protected] > > > > > >> Note: please don't send private questions to me, as I don't have > time to > > > >> provide private support. All such questions should be posted on > public > > > >> forums, where I and others can see and answer them. > > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > [email protected] > > > > > Note: please don't send private questions to me, as I don't have time > to > > > provide private support. All such questions should be posted on public > > > forums, where I and others can see and answer them.- Hide quoted text - > > > > > - Show quoted text - > > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

