1

Possible Duplicate:
I want my android application to be only run in portrait mode?

I want to set the database for run only vertically not in horizontally so what changes in application ?

Community
  • 1
  • 1
ghanshyam
  • 35
  • 1
  • 4
  • 1
    do you want to run the app in only portrait mode ? – Chirag Feb 21 '12 at 10:11
  • 1
    You do not need to personally thank every single person who answers your question, as it's considered noise and it's generally implied anyway. If you find a best answer, click the checkmark to mark it accepted. – BoltClock Feb 21 '12 at 17:31

4 Answers4

3

You can specify in your activity in manifest.xml how you want it to work

e.g

<activity
android:screenOrientation="landscape"> //for landscape ie horizontal

and

<activity
android:screenOrientation="portrait"> //for portrait ie vertical
Rajeel
  • 384
  • 2
  • 7
1

If you want to make your application in force portrait mode you can to do by adding this in the manifest file :

<activity android:name=".activityName" android:screenOrientation="portrait" />
Nibha Jain
  • 7,742
  • 11
  • 47
  • 71
1

Your question is too vague.

To use your application only vertically (portrait) mode, then following changes you have to do in manifest file

<activity android:name=".YourActivity" android:screenOrientation="portrait">

This will allow your activity to run in vertical mode (portrait mode) only and its activity configuration will not be changed even if you change device orientation.

AndroDev
  • 3,236
  • 8
  • 35
  • 49
0

You do this in the AndroidManifest.xml file on the activity. Take a look at the Activity element documentation.

<activity android:name=".MyCustomActivity"
android:screenOrientation="portrait"
[...]

Programmatically you can do this in your activity as follows:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
Ali
  • 12,354
  • 9
  • 54
  • 83