Phil,

This has both rounded (mdpi, ldpi, etc.) values and actual resolution, that you'd want to use for a ruler:

http://developer.android.com/reference/android/util/DisplayMetrics.html

Note that some devices don't correctly report actual resolution (xdpi / ydpi).

Canvas also has density available:

http://developer.android.com/reference/android/graphics/Canvas.html#getDensity()

-- Kostya

31.12.2010 15:35, Phil Endecott пишет:
Hi All,

Imagine trying to display an accurate ruler on the screen, or
something like that.  I'd like to know the screen's pixel density in
pixels-per-inch, or equivalently its dimensions in mm and resolution
in pixels, so that I know the accurate physical size of the thing that
I'm drawing.  Is there any way to get this info?

Failing that, I'm aware that the system knows the approximate density
(one of three values IIRC).  How can I retrieve this programatically?


Thanks,  Phil.



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to