android get screen width and height code example
Example 1: how to get width android
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Example 2: android get screen width and height
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
float dpWidth = displayMetrics.widthPixels / displayMetrics.density;
Log.d("MyHeight", dpHeight+"");
Log.d("MyWidth", dpWidth+"");