Posts Tagged ‘Screen’

How to get the screen size in Android?

December 8, 2009 Leave a comment

Android screen size is different from different phone models.

There are some screen resolutions 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 we can see how to get the screen size ,

public void onCreate(Bundle savedInstanceState) {


int h;
int w;

DisplayMetrics displaymetrics = new DisplayMetrics();
h = displaymetrics.heightPixels;
w = displaymetrics.widthPixels;

By using this code we can get the screen size in pixels.