1. Download our Official Android App: Forums for Android!

Apps Android Screen Size

Discussion in 'Android Development' started by momersaleem, Jan 17, 2014.

  1. momersaleem

    momersaleem Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Jul 6, 2011

    Jul 6, 2011
    3
    0
    5
    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
     

    Advertisement

  2. Rukbat

    Rukbat Android Expert
    Rank:
    None
    Points:
    843
    Posts:
    10,392
    Joined:
    Jan 16, 2012

    Jan 16, 2012
    10,392
    2,894
    843
    Male
    Being retired and writing Tasker tasks.
    Fayetteville, NC, USA
    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.
     
  3. surlac

    surlac Newbie
    Rank:
    None
    Points:
    16
    Posts:
    25
    Joined:
    Jun 17, 2012

    Jun 17, 2012
    25
    4
    16
    Male
    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.
     

Share This Page

Loading...