Last active
December 15, 2015 12:19
-
-
Save davetrux/5259897 to your computer and use it in GitHub Desktop.
Using newer Android APIs in an older version
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
/* | |
* Handles Gingerbread crash due to implementation change | |
*/ | |
private static Point getDisplaySize(final Display display) { | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
return APIv11.getDisplaySize(display); | |
} else { | |
final Point point = new Point(); | |
point.x = display.getWidth(); | |
point.y = display.getHeight(); | |
return point; | |
} | |
} | |
private static class APIv11 { | |
private static Point getDisplaySize(Display display) { | |
final Point point = new Point(); | |
display.getSize(point); | |
return point; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment