1DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
2float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
3float dpWidth = displayMetrics.widthPixels / displayMetrics.density;
4Log.d("MyHeight", dpHeight+"");
5Log.d("MyWidth", dpWidth+"");
1Display display = getWindowManager().getDefaultDisplay();
2Point size = new Point();
3display.getSize(size);
4int width = size.x;
5int height = size.y;
6