cottonBallPaws
cottonBallPaws

Reputation: 21600

How to be notified when orientation would have changed, after using setRequestedOrientation()?

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...

Upvotes: 0

Views: 668

Answers (1)

cistearns
cistearns

Reputation: 2508

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

Upvotes: 1

Related Questions