Get Size and Orientation of the Screen
/* 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();
2 Comments
According to the discussion in the following thread, the orientation of the screen should not be retrieved in this way. Instead, getResources().getConfiguration().orientation should be used.
http://groups.google.com/group/android-developers/browse_thread/thread/805764447b58a816
here is a nice Example
http://www.ceveni.com/2009/08/how-to-get-screen-orientation-in.html
to get screen resolution and mode
Add a Comment