Created
January 4, 2014 16:40
-
-
Save dominicthomas/8257190 to your computer and use it in GitHub Desktop.
Android screen size with platform backwards compatibility.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Point getScreenSize() { | |
Point size = new Point(); | |
WindowManager w = getWindowManager(); | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
w.getDefaultDisplay().getSize(size); | |
}else{ | |
Display d = w.getDefaultDisplay(); | |
size.x = d.getWidth(); | |
size.y = d.getHeight(); | |
} | |
return size; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment