Http://stackoverflow.com/questions/9627774/android-allow-portrait-and-landscape-for-tablets-but-force-portrait-on-phone
Here's a good the using resources and size qualifiers.
Put this bool resource in res/values as Bools.xml or whatever (file names don ' t matter here):
<?xml version="1.0" encoding="utf-8"?> <resources> <bool name="portrait_only">true</bool> </resources>
Put this one in RES/VALUES-SW600DP and Res/values-xlarge:
<?xml version="1.0" encoding="utf-8"?> <resources> <bool name="portrait_only">false</bool> </resources>
Then, in the OnCreate method of your activities you can does this:
if(getResources().getBoolean(R.bool.portrait_only)){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); }
Devices that is more than-DP in the smallest width direction, or x-large on Pre-android 3.2 Devices (tablets, basical LY) would behave like normal, based on sensor and user-locked rotation, etc. Everything else (phones, pretty much) would be portrait only.