You can get the Android Phone Screen dimensions in the following ways :
1)
3)
1)
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
2)Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth(); // deprecated
int height = display.getHeight(); // deprecated
3)
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height =
metrics.heightPixels;
int width =
metrics.widthPixels;
No comments:
Post a Comment