1Display display = getWindowManager().getDefaultDisplay();
2Point size = new Point();
3display.getSize(size);
4int width = size.x;
5int height = size.y;
6
1DisplayMetrics displayMetrics = new DisplayMetrics();
2getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
3int height = displayMetrics.heightPixels;
4int width = displayMetrics.widthPixels;