Um, if I am reading that right, it is exactly working as intended. With setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) you are saying to keep the screen in landscape, so the orientation shouldn't change. In fact you shouldn't see the screen actually rotating, just the keyboard hidden state changing.
Am I missing something? On Tue, Apr 28, 2009 at 5:36 PM, [email protected] < [email protected]> wrote: > > Hey Dianne, > > Thanks for your reply, below is a sample of the code that I am using: > > @Override > public void onConfigurationChanged(Configuration newConfig) { > super.onConfigurationChanged(newConfig); > Log.i(TAG, "WM getOrientation: " > + ((WindowManager) getSystemService > (WINDOW_SERVICE)).getDefaultDisplay().getOrientation()); > Log.i(TAG, "getResources: " + > getResources().getConfiguration > ().orientation); > Log.i(TAG, "newConfig: " + newConfig.orientation); > } > > As well as adding the following to the Android XML file so that I can > handle rotation events locally: > > <activity android:name=".SinEgen" > android:label="@string/app_name" > android:configChanges="keyboardHidden|orientation"> > > The following is the output after two successive rotations: > > 04-29 00:28:08.588: INFO/sinEgen(883): WM getOrientation: 1 > 04-29 00:28:08.588: INFO/sinEgen(883): getResources: 2 > 04-29 00:28:08.598: INFO/sinEgen(883): newConfig: 2 > 04-29 00:28:10.326: INFO/WindowManager(569): Config changed: > { scale=1.0 imsi=0/0 locale=en_GB touch=3 key=2/1/2 nav=3 orien=2 } > 04-29 00:28:10.449: DEBUG/dalvikvm(569): GC freed 1837 objects / > 114064 bytes in 126ms > 04-29 00:28:10.459: INFO/WindowManager(569): onOrientationChanged, > rotation changed to 0 > 04-29 00:28:10.549: DEBUG/StatusBar(569): updateResources > 04-29 00:28:10.639: INFO/sinEgen(883): WM getOrientation: 1 > 04-29 00:28:10.639: INFO/sinEgen(883): getResources: 2 > 04-29 00:28:10.639: INFO/sinEgen(883): newConfig: 2 > > As you can see none of the methods used are detecting any orientation > change at all! > > However if I remove: > > > setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); > > From my activities onCreate() function they all successfully detect > orientation changes: > > 04-29 00:35:32.939: INFO/sinEgen(720): WM getOrientation: 1 > 04-29 00:35:32.939: INFO/sinEgen(720): getResources: 2 > 04-29 00:35:32.939: INFO/sinEgen(720): newConfig: 2 > 04-29 00:35:32.959: WARN/ActivityManager(567): Activity idle timeout > for HistoryRecord{4358b930 {com.android.jamesgrafton.sinEgen/ > com.android.jamesgrafton.sinEgen.SinEgen}} > 04-29 00:35:33.168: INFO/WindowManager(567): Config changed: > { scale=1.0 imsi=0/0 locale=en_GB touch=3 key=2/1/2 nav=3 orien=2 } > 04-29 00:35:33.229: INFO/WindowManager(567): onOrientationChanged, > rotation changed to 0 > 04-29 00:35:33.229: INFO/WindowManager(567): Setting rotation to 0, > animFlags=0 > 04-29 00:35:33.279: INFO/WindowManager(567): Config changed: > { scale=1.0 imsi=0/0 locale=en_GB touch=3 key=2/1/2 nav=3 orien=1 } > 04-29 00:35:33.349: INFO/ARMAssembler(567): generated > scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at > [0x1ecd80:0x1ece8c] in 432527 ns > 04-29 00:35:33.389: DEBUG/StatusBar(567): updateResources > 04-29 00:35:33.509: DEBUG/StatusBar(567): updateResources > 04-29 00:35:33.519: INFO/sinEgen(720): WM getOrientation: 0 > 04-29 00:35:33.549: INFO/sinEgen(720): getResources: 1 > 04-29 00:35:33.549: INFO/sinEgen(720): newConfig: 1 > > I must admit I am at a loss! > > > On Apr 28, 5:48 pm, Dianne Hackborn <[email protected]> wrote: > > I don't know what to say, they certainly do in all the cases I know of. > You > > must want to put together short as possible sample code showing the > problem > > happening; otherwise, with no way to repro (and no code to see exactly > what > > you are doing), I can't help any more. > > > > On Tue, Apr 28, 2009 at 7:23 AM, [email protected] < > > > > > > > > [email protected]> wrote: > > > > > The problem for me though is that the constants returned never change > > > after I set a preferred Orientation no matter how I rotate the > > > Phone :/ > > > > > On Apr 28, 4:34 am, Dianne Hackborn <[email protected]> wrote: > > > > 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. > > > > -- > > 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. > > > -- 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 -~----------~----~----~----~------~----~------~--~---

