Get screen density
suggest changeTo 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;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents