Android get screen width and screen
The size of a desktop computer monitor is determined by physically measuring the screen. Using a measuring tape, start at the top-left corner and pull it diagonally to the bottom-right corner. Be sure to only measure the screen; do not include the bezel (the plastic edge) around the screen.
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
float displayHeight = displayMetrics.heightPixels / displayMetrics.density;
float displayWidth = displayMetrics.widthPixels / displayMetrics.density;
Log.d(“Display Height”, displayHeight +””);
Log.d(“Display Width”, displayWidth +””);