I want to get the dpi of the device's screen but when I use:
DisplayMetrics m = getResources().getDisplayMetrics();
float den = m.density;
I get the full DisplayMetrics
object as zero (I saw it in the debugging).
It was the same also in my emulator (android 2.3) and on my phone (Htc Legend android 2.1 update 1).
The code is located in my activity class(extends Activity
) and then
WebView.setWebChromeClient(new MyWebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
DisplayMetrics m = getResources().getDisplayMetrics();
float den = m.density;
}
How can I fix It?
Thank You,
Boaz