http://stackoverflow.com/questions/9627774/android-allow-portrait-and-landscape-for-tablets-but-force-portrait-on-phone
Here's a good way using and .
Put this bool resource in res/values as bools.xml or whatever (file names don't matter here):
true
Put this one in res/values-sw600dp and res/values-xlarge:
false
Then, in the onCreate method of your Activities you can do this:
if(getResources().getBoolean(R.bool.portrait_only)){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
Devices that are more than 600 dp in the smallest width direction, or x-large on pre-Android 3.2 devices (tablets, basically) will behave like normal, . Everything else (phones, pretty much) will be portrait only.