Skip to content

Instantly share code, notes, and snippets.

@alxsimo
Created January 22, 2015 15:42
Show Gist options
  • Select an option

  • Save alxsimo/cb6e0484c57704b39fcb to your computer and use it in GitHub Desktop.

Select an option

Save alxsimo/cb6e0484c57704b39fcb to your computer and use it in GitHub Desktop.
[Android] Device display density
switch (getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
// ...
break;
case DisplayMetrics.DENSITY_MEDIUM:
// ...
break;
case DisplayMetrics.DENSITY_HIGH:
// ...
break;
case DisplayMetrics.DENSITY_XHIGH:
// ...
break;
}
// More info: http://developer.android.com/intl/es/reference/android/util/DisplayMetrics.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment