Wrong display width and height in Android
I have a screen size of 600 (width) x 1024 (height). I get current width 600 but incorrectly get height 976 (without rotated screen). I get current width 1024 but wrong get height 552 (with rotated screen). int rowPixelWidth = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth(); int rowWidth = (int)Math.floor(rowPixelWidth / this.getResources().getDisplayMetrics().density); int rowPixelheight = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight(); int rowheight = (int)Math.floor(rowPixelheight / this.getResources()