-1

I am in trouble with Portrait and Landscape modes of my android application. So, I want to know how to restrict my application in anyone mode only. Thanks in advance to any reply with suitable answer and problem solving solution.

John Kiran
  • 79
  • 1
  • 14
  • 2
    possible duplicate of [How to disable orientation change in Android?](http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android) – Abhinav Singh Maurya Jul 21 '15 at 10:35

4 Answers4

4

You can define your screen Orientation in your manifest file, activity tag

android:screenOrientation="landscape"

for more detail refer here.

Gunaseelan
  • 14,415
  • 11
  • 80
  • 128
2

add the below code in the activity tag of your manifest file...

android:screenOrientation="landscape"
Rishad Appat
  • 1,786
  • 1
  • 15
  • 30
1

Add android:screenOrientation to your activity tag in manifest file like below code:

<activity
    android:name="com.packagename.YourActivity"
    android:screenOrientation="portrait" >
</activity>
Pankaj
  • 7,908
  • 6
  • 42
  • 65
0

Try this:

<activity
      android:name=".MyActivity"
      android:configChanges="orientation|keyboardHidden|keyboard"
      android:screenOrientation="portrait" />
Jonas Czech
  • 12,018
  • 6
  • 44
  • 65