How to know whether its a tablet or phone in android programmatically? [duplicate]
问题 This question already has answers here : Tablet or Phone - Android (30 answers) Closed 5 years ago . I would like to get to detect whether the given device is a tablet or phone in android.I have tried the two in the simulator but none worked. Both are here: First if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { //code } Second private boolean isTabletDevice() { if (android.os.Build.VERSION.SDK_INT >= 11) {