I want to block my application orientation to portrait, but still receive orientation changes events. So I've tried to add the android:screenOrientation="portrait"
attribute for blocking the orientation and the android:configChanges="keyboardHidden|orientation"
attribute for receiving the orientation changes events in the ovverriden method onConfigurationChanged
. Still the method doesn't get called. Is there a way to achieve this?
Asked
Active
Viewed 1,123 times
4
-
Did you find a solution for this? I'm trying to do something similar. – harbinja Feb 10 '12 at 19:15
3 Answers
1
By forcing the orientation of your activity to portrait mode, you're not able to receive orientation changes.

Balaji Khadake
- 3,449
- 4
- 24
- 38
-
So there's no way you could specify a certain orientation and receive the notifications? – Gratzi Jul 27 '11 at 12:43
-
According to my knowledge it's not possible. Check this one post over here. http://stackoverflow.com/questions/5620033/onconfigurationchanged-not-getting-called – Balaji Khadake Jul 27 '11 at 12:56
-
I've read it and some say that it should work. But for me it doesn'r. Anyway, I think don't understand why bloking the orientation should block the notifications. Those are separate functions. It has no logic. – Gratzi Jul 27 '11 at 13:02
-
1
Check Manifest.xml file. It should be like as below:
<activity android:name="YourActivity1"
android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name="YourActivity2"
android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan"
android:configChanges="orientation|keyboardHidden"></activity>
-1
are you sure you write this for main activity like < activity android:screenOrientation="portrait"...

GauravSTomar
- 604
- 1
- 7
- 26