-3

In my application I have 10 activities. I want to set portrait view for all pages. How to do it pro-grammatically.

  • [Related](http://stackoverflow.com/questions/6654675/programmatically-lock-into-portrait-mode-for-certain-operations) – Renjith Aug 20 '13 at 06:29

2 Answers2

0

To do it pro-grammatically in every activity.

@Override
    public void onCreate(Bundle savedInstanceState) {
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
}
Arun C
  • 9,035
  • 2
  • 28
  • 42
0

I suggest to use the AndroidManifest.xml for doing this. Code you need:

<activity android:name=".YourActivity"
    android:configChanges="orientation"
    android:screenOrientation="portrait"/>
Cristian Holdunu
  • 1,880
  • 1
  • 18
  • 43