-2

I would like to keep the screen in a portrait position and not allowed screen rotation in my app. How should I do that ?

Galaxy
  • 3
  • 3
  • Here is how you disable landspace http://thegeekyland.blogspot.com/2014/06/activity-screen-rotationorientation.html – Arlind Dec 04 '15 at 19:10

1 Answers1

2

I can recall two ways, either try putting a ScreenOrientation in your manifest :

android:screenOrientation="portrait" // OR "landscape"

Or just do the following in code :

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // ORActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
Mekap
  • 2,065
  • 13
  • 26