I was trying to get the screen resolution of android phones,using this code
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDi
Try to use this:
width = getResources().getDisplayMetrics().widthPixels;
height = getResources().getDisplayMetrics().heightPixels;
Seems like you're getting the pixel after division of the density ( 1.5 ) of Galaxy S.
480 / 1.5 = 320
799.5 / 1.5 = 533
Edit:
density = getResources().getDisplayMetrics().density;