I have been working on a Android project, that is intended to be compatible with both the Android phones and tablets. On the tablet the app is working great and looks good too. However, on the phone we have been running into issues both programmatically and layout wise (working with a 10.1 inch screen is a lot easier than a 4 inch screen). To solve some of these problems we have decided to deactivate screen orientation but only for the phone version, atleast temporarily.
The question is simple, how do I deactivate the screen orientation for Android phone, while keeping it active for the Android tablets? I know I can do this in the manifest file, however, this will also lock the orientation for the tablet I believe.
You can do it from application as well.
Lock screen orientation (Android)
http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation(int)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
And attributes can be found here:
http://developer.android.com/reference/android/R.attr.html#screenOrientation
To detect, if Android device is Tablet or Phone, you should use this solution (different SO Q&A), https://stackoverflow.com/a/9308284/492624