Get Size and Orientation of the Screen

3 votes · 0 comments

Get the current orientation and size of the screen with android.view.Display and WindowManager.

raw ·
copy
· download
/* First, get the Display from the WindowManager */ Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); /* Now we can retrieve all display-related infos */ int width = display.getWidth(); int height = display.getHeight(); int orientation = display.getOrientation();

Be the first to comment

Sign in with OpenID