I need to get the window height and the weight.
I have this in my code:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDispl
Use this:
display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getWidth(); // to get width of the screen
display.getHeight(); // to get height of the Screen
UPDATE
Please review the Android-Developer site. For more reference.
You can use below snippet of code to fetch height-width of the device.
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;