How to set application in port mode only? I does not wanna when phone landscape is on my application should still work in port mode dose not change to land mode.
Asked
Active
Viewed 228 times
4 Answers
1
You can use this in your manifest file for your Activity to restrict the application to Portrait mode:
<activity
android:name="com.package.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
Hope it helps.

MysticMagicϡ
- 28,593
- 16
- 73
- 124
-
thnxs! ones again :) – Hitesh Matnani Sep 29 '14 at 07:35
-
yha sure i will accept it but i cant accept it before 8 mints as stackoverflow does not give me permission to do that :P – Hitesh Matnani Sep 29 '14 at 07:40
0
You do it in the MANIFEST file, where you declare your Activity.
Set the screenOrientation
property to portrait
, like this:
<activity
android:name=".MyActivity"
android:screenOrientation="portrait" >
</activity>

Richard Le Mesurier
- 29,432
- 22
- 140
- 255
0
You can set your application mode using AndroidManifest.xml:
<activity android:name=".YourActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"/>
Or you can do it programatically:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

MSA
- 2,502
- 2
- 22
- 35
0
Add the following code in your APP MANIFEST file,
Set screenOrientation
property to portrait
,:
<activity
android:name=".MainActivity"
android:screenOrientation="portrait" >
</activity>

Sagar Pilkhwal
- 3,998
- 2
- 25
- 77