Answer the question
In order to leave comments, you need to log in
How to check device or screen?
Hello, please help me to solve this problem. I have an application that is displayed in vertical orientation, and I'm fine with it. I wish there was a landscape orientation for tablets and a vertical orientation for phones. How to implement this?
Answer the question
In order to leave comments, you need to log in
You can create folders in resources, the contents of which will be loaded if the screen meets the minimum requirements for width, height, density, or all together. Define the minimum screen width and height for smartphone and tablet. Make a folder for each, and add the necessary suffixes to the name. See here: developer.android.com/guide/topics/resources/providing-resources.html
private bool isTabletModeDetermined = false;
private bool isTabletMode = false;
//....
public static boolean isTablet(Context paramContext) {
if (!isTabletModeDetermined) {
if (paramContext.getResources().getConfiguration().smallestScreenWidthDp>= 600)
isTabletMode = true;
isTabletModeDetermined = true;
}
return isTabletMode;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question