Reputation: 3226
As we can get the resolution in android, but how can we know the density of the device (screen) ?
thanks
Upvotes: 11
Views: 10358
Reputation: 9629
Execute the following code:
float scale = getApplicationContext().getResources().getDisplayMetrics().density;
and check the value of scale
:
0.75
means low density1.0
means standard (medium) density1.5
means high (large) density2.0
means extra high density3.0
means extra extra high density4.0
means extra extra extra high densitySee the documentation for more info.
Upvotes: 27