Disable display rotation - How ??

Put your problem here if it does not fit any of the other categories.

Disable display rotation - How ??

Postby Pato84 » Fri Jun 11, 2010 10:49 am

Hello,

i have developed an android application.

Now i want disable the display rotation by switching the display 90 grade to right or left.

How can i do that.

Thanks for help

Fabian
Pato84
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Mar 11, 2010 2:36 pm

Top

Re: Disable display rotation - How ??

Postby luugiathuy » Fri Jun 11, 2010 10:58 am

Hi,

You can disable by adding:

android:screenOrientation="portrait"

to your activity in AndroidManifest.xml

Ex:
Code: Select all
<activity android:name=".YourActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">


Hope this helps!
luugiathuy
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Jun 01, 2010 3:16 am

Re: Disable display rotation - How ??

Postby Chitra » Fri Jun 11, 2010 2:26 pm

Hi Pato,
Add below code in your's activity onCreate(Bundle savedInstanceState) method...

//Its allow only for portrait mode
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Thanks,
Chitra
User avatar
Chitra
Master Developer
Master Developer
 
Posts: 213
Joined: Mon Mar 01, 2010 7:59 am
Location: Bangalore

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 21 guests