Issue
This morning I came up with a problem trying to handle the onConfigurationChanged
event. The problem is that the method, which I override, is not getting called when I change the orientation of the phone. Not getting called at all.
I've put android:configChanges="orientation"
on the activity defined in the manifest as mentioned on the android documentation, but this don't make a difference.
Have you come up with this problem?
Solution
The problem was that if you use this method
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
to force the orientation of your Activity
to portrait mode, you're not candidate to receive orientation
changes.
So the solution is to not setRequestOrientation
to a particular mode. But instead use SCREEN_ORIENTATION_SENSOR.
Answered By - lblasa
Answer Checked By - Terry (JavaFixing Volunteer)