How to get Android Device Density Unit

I want to click on certain point(x,y) on a android device. But as i figured it out i need to get density unit of that device to equilibrate my point according to different devices.

I wonder how can i get ths density unit to use in my code.

You can use adb commands here:
one like adb shell getprop ro.sf.lcd_density or adb shell dumpsys window | grep DisplayWidth .

adb shell dumpsys window displays will return something like `init=1440x2560 640dpi cur=1440x2560 app=1440x2392 rng=1440x1340-2392x2292` in third line , may be you can use this .

Hope this helps .

Thanks,
Donald

But is it possible to get it in my code side?

You just have to figure out, how you can run shell commands from your code. It depends on your scripting language like in ruby you can use System keyword and in Java, you can use Runtime.getRuntime().exec to execute external shell command http://goo.gl/UPt7qq .

Thanks,
Donald