Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I lock the layout of my android program to one orientation [duplicate]

Possible Duplicate:
Don’t want activity to be destroyed/created when phone is rotated

I'm trying to write a program that needs smooth orientation sensor samples as the phone is rotated all around. Every time the orientation of the phone is changed, it interrupts the data and freezes the program while the layout changes. How can I lock it in one orientation (landscape or portrait, it doesn't matter)?

I assume it has something to do with android:layout in the xml file, but I can't find anything online.

like image 994
Mike V Avatar asked Nov 29 '22 04:11

Mike V


1 Answers

Simplest and one of ways to do this would be having android:screenOrientation="portrait|landscape"
property for the <activity> tag in your AndroidManifest.xml file.

like image 74
Samuh Avatar answered Dec 08 '22 00:12

Samuh