• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android Screen Size

Hello,

According to my research and information, I got to know that the devices with screen resolution 1280x720 or 720x1280 are extra large screen devices.

But when I run my application on Samsung Galaxy S3 SGH-T999 (resolution 720x1280) throught eclipse, the following code prints "Normal screen" i.e. it is a normal screen device but according to my knowledge it should print "Extra Large screen". If its a normal screen size device actually then why its picking the layout (XML) file from res/layout-xlarge-port folder instead of res/layout? Please correct me if I am wrong and please help me out to understand this screen size concept so that I can make my application for multiple screen sizes.

// get and check the screen size of the device
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;

switch(screenSize) {
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
Toast.makeText(this, "Extra Large screen",Toast.LENGTH_LONG).show();
break;
case Configuration.SCREENLAYOUT_SIZE_LARGE:
Toast.makeText(this, "Large screen",Toast.LENGTH_LONG).show();
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
Toast.makeText(this, "Normal screen",Toast.LENGTH_LONG).show();
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
Toast.makeText(this, "Small screen",Toast.LENGTH_LONG).show();
break;
default:
Toast.makeText(this, "Screen size is neither large, normal or small" , Toast.LENGTH_LONG).show();
}

Thanks in advance,
momersaleem
 
Feed the switch statement various sizes until you figure out the point at which it switches from Large screen to Extra large screen. If it makes sense, you have your answer. If not, look at SCREEN_LAYOUT_SIZE_MASK and see what it's doing to the size being returned by screenLayout.
 
Samsung Galaxy S3 display is "normal" because its size is 5.97x10.62(cm).
It should be at least 7.62x10.16(cm) to be "large" according to doc.
 
Back
Top Bottom