How to get the screen density programmatically in android?
I mean: How to find the screen dpi of the current device?
This also works:
getResources().getDisplayMetrics().density;
This will give you:
0.75 - ldpi
1.0 - mdpi
1.5 - hdpi
2.0 - xhdpi
3.0 - xxhdpi
4.0 - xxxhdpi
ref: density
ref 2