How to get the screen density programmatically in android?
I mean: How to find the screen dpi of the current device?
If you want to retrieve the density from a Service it works like this:
WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics metrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(metrics);