ulfben

Android get screen density name (bucket)

Jan 25th, 2017
1,300
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. //https://developer.android.com/about/dashboards/index.html#Screens
  2. private static String getDensityName(DisplayMetrics dm) {
  3.         float density = dm.density;
  4.         if (density >= 4.0) {
  5.             return "xxxhigh density";
  6.         }
  7.         if (density >= 3.0) {
  8.             return "xxhigh density";
  9.         }
  10.         if (density >= 2.0) {
  11.             return "xhigh density";
  12.         }
  13.         if (density >= 1.5) {
  14.             return "high density";
  15.         }
  16.         if (density >= 1.0) {
  17.             return "medium density";
  18.         }
  19.         return "low density";
  20.     }
Advertisement
Comments
  • Rteuixl
    217 days
    # text 0.21 KB | 0 0
    1. Best t33n active cpx link daily updates!
    2.  
    3. Copy and paste the link in a new browser tab and then hit enter!
    4.  
    5. https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
    6.  
    7. Remove the @
  • Comment was deleted
Add Comment
Please, Sign In to add comment