Wednesday, June 3, 2015

Get Screen Size of Device

If you want to get Screen Size of Device then do it as follows
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
and if you are using in API < 13 then use
Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();  // deprecated
int height = display.getHeight();