I am trying to accomplish Reto Meier\'s recommended way for keeping the screen orientation from changing. The slides from his talk during Google IO (see #23) can be found in
All 30+ lines of code that currently are not working can be replaced with some XML values in your AndroidManifest.xml
file.
We have all seen
<activity android:name=".YourActivity" android:screenOrientation="portrait" ></activity>
and we all know that doesn't work well with tablets that have a default orientation of landscape. But how many of you have seen this?
<activity android:name=".YourActivity" android:screenOrientation="nosensor" ></activity>
Basically it makes it so that the device's orientation doesn't respond to the sensor. So if your default is landscape or portrait it won't change. I have tested it on my Droid X and on a Xoom and it works like I would have expected it to.
I hope this helps others.