Android screen size is different for different phone models.

There are some screen resolutions already defined in Android.

They are:

  • QVGA (240×320, low density, small screen)
  • WQVGA (240×400, low density, normal screen)
  • FWQVGA (240×432, low density, normal screen)
  • HVGA (320×480, medium density, normal screen)
  • WVGA800 (480×800, high density, normal screen)
  • WVGA854 (480×854 high density, normal screen)

Now let’s see how to get the screen size,

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

int ht;

int wt;

DisplayMetrics displaymetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

ht = displaymetrics.heightPixels;

wt = displaymetrics.widthPixels;

}



Here, ht will return the height & wt will return the width.

 

http://www.androidpeople.com/category/screen/

+ Recent posts