Android access to the screen width

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
Previously acquired both length and width of the: WindowManager w = this.getWindowManager();
windowHeight = w.getDefaultDisplay().getHeight();
windowWidth = w.getDefaultDisplay().getWidth();
But this method is not recommended.


Now get the length and width of the screen: // get the length and width of Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
windowHeight = size.y;
windowWidth = size.x;
Log.i("TTTT", "height:"+ windowHeight);
Log.i("TTTTT","width:"+ windowWidth);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Vicky at November 28, 2013 - 9:49 PM