I am an Android Developer

Friday, July 16, 2010

Get Size and Orientation of the Screen of Android Device

/* 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();

No comments:

Post a Comment