Is there a way to force the tablet to be in landscape mode as default orientation when the user start's my app. Is there a way to do this with theming or something like that, so the user doent see orientation change when he is starting the app?
Note: the same app is (should be) in portrait mode for phones
For now I have a boolean values folder refs.xml(both values and values-large) with different value for tablet and phone, but the user can see that the app is rotating Code:
public static boolean isTablet(Context context) {
return (context.getResources().getBoolean(R.bool.isTablet));
}
if (isTablet(getApplicationContext())) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setContentView(R.layout.yourlayout);
**//this method for check having run in tablet or not??**
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}