How can I prevent the activity from redrawing in the new orientation out when the device is tilted? I want the onCreate
function to not execute a second time after the activity has been shown.
If you want to cope with tablet devices then you should use the nosensor
value instead, e.g.
<activity android:name=".MyActivity"
android:screenOrientation="nosensor" ></activity>
This will use the natural orientation for the device, which will be landscape on some devices (e.g. the Xoom tablet).
API docs for this are here:
The orientation is determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the "unspecified" setting.
http://developer.android.com/guide/topics/manifest/activity-element.html#screen
you can fix the screen orientation. Add this to your activity tag in your manifest file:
android:screenOrientation = "portrait"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With