Android Device Display Metrics suggest change

Get screen density

To get the screens density, we also can make use of the Windowmanagers DisplayMetrics. This is a quick example:

// Get density in dpi
DisplayMetrics metrics = new DisplayMetrics();
context.getWindowManager().getDefaultDisplay().getMetrics(metrics);
int densityInDpi =  metrics.densityDpi;

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents