views:

25

answers:

1

My Activity locks its orientation by using setRequestedOrientation(). However, once this is set to something other than ActivityInfo.SCREEN_ORIENTATION_SENSOR, onConfigurationChange() is no longer called (since it is not changing anymore) when the user rotates their device.

Is there a way, after the orientation is set with setRequestedOrientation(), to still detect when the orientation of the phone changes? Or to say it another way, when onConfigurationChange() would have been called, even though it's no longer being called?

I want to know when the orientation physically has changed, even though I have already locked the view with setRequestedOrientation().

Hope that makes sense...

+1  A: 

You will need to monitor the orientation yourself. Specifically you will want to look at OrientationEventListener. http://developer.android.com/reference/android/view/OrientationEventListener.html

cistearns