Created
January 26, 2018 19:16
-
-
Save DevPicon/7db90855f6e3c49ff933557c9bb6df84 to your computer and use it in GitHub Desktop.
Some util methods to work with screen density and screenlayout
This file contains hidden or 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 boolean hasSmallDensity() { | |
int densityDpi = getResources().getDisplayMetrics().densityDpi; | |
if (densityDpi < DisplayMetrics.DENSITY_MEDIUM) { | |
return true; | |
} | |
return false; | |
} | |
private boolean hasSmallScreen() { | |
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment