Search code examples
androidandroid-orientation

Orientation change bug


I use setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in my activites.

My application turns to landscape mode just for a very short duration like about 0.2 seconds if i change betwen activities. After the ladnscape change it is changes back to portrait but it is very annoying bug.

Why is it happening ? Is there a better way to restrict the application to only use PORTRAIT orientation?

I dont want the 0.2 sec flashy orientation change.


Solution

  • If you want your Activities to be in portrait all the time, you should specify the android:screenOrientation:"portrait" xml tag in your AndroidManifest.xml for each <activity> tag.