Re: [android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-02-03 Thread Dianne Hackborn
On Wed, Feb 2, 2011 at 6:58 PM, Indicator Veritatis mej1...@yahoo.comwrote: By The density and densityDpi is an abstract density bucket the device manufacturer has decided makes sense for their UI to run in, do you mean that the two of them together, 'density' and 'densityDpi' are part of

Re: [android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-02-03 Thread Dianne Hackborn
On Thu, Feb 3, 2011 at 7:08 PM, Dianne Hackborn hack...@android.com wrote: density = DENSITY_MEDIUM / densityDpi Gah, this is of course: density = densityDpi / DENSITY_MEDIUM -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me,

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-02-03 Thread DanH
If you need accuracy, there's really no other option than to have the user calibrate the device. I've seen the same problem on Nokia phones -- the N97 and N97mini have (nearly) the exact same OS features, so report the same screen size. But the mini is about 10% smaller. In the wild and woolly

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-02-02 Thread Richard Schilling
That's very interesting Dianne, and thanks for taking the time to weigh in. What you are saying makes sense too because the physical size of the screens on Android devices differ. At the very least I expect that each device does the calculations properly when displaying widgets. Or, is that

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-02-02 Thread Indicator Veritatis
By The density and densityDpi is an abstract density bucket the device manufacturer has decided makes sense for their UI to run in, do you mean that the two of them together, 'density' and 'densityDpi' are part of one bucket? I suppose if I knew this API better the answer would be obvious, but as

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-14 Thread Phil Endecott
On Jan 12, 8:33 pm, Dianne Hackborn hack...@android.com wrote: Unfortunately, I don't have a good solution if you want to get the real exactly screen dots per inch. One thing you could do is compare xdpi/ydpi with densityDpi and if they are significantly far apart, assume the values are bad

Re: [android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-14 Thread Dianne Hackborn
On Fri, Jan 14, 2011 at 8:30 AM, Phil Endecott spam_from_goo...@chezphil.org wrote: Thanks Dianne. What's going on with the Tab? Its true dpi, which it does accurately report in the xdpi and ydpi fields, is about 170. I could imagine that a tablet might be typically held further from the

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-14 Thread Phil Endecott
On Jan 14, 5:26 pm, Dianne Hackborn hack...@android.com wrote: On Fri, Jan 14, 2011 at 8:30 AM, Phil Endecott spam_from_goo...@chezphil.org wrote: Thanks Dianne. What's going on with the Tab? Its true dpi, which it does accurately report in the xdpi and ydpi fields, is about 170. I

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-12 Thread Phil Endecott
Note that some devices don't correctly report actual resolution (xdpi / ydpi). Does some devices include anything that I care about? How wrong is the value? Answering my own question: yes, it is wrong on my Motorola Defy, which returns 96. Googling tells me it is wrong on quite a lot of

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-12 Thread Richard Schilling
Did you try fetching the scale that will allow you to convert from DPI to actual screen pixels? I found this very reliable: final scale = getContext().getResources().getDisplayMetrics().density; Then multiply scale by one inch of pixels in DPI resolution (depending on the screen you're on)

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-12 Thread Phil Endecott
Hi Richard, On Jan 12, 6:54 pm, Richard Schilling richard.rootwirel...@gmail.com wrote: Did you try fetching the scale that will allow you to convert from DPI to actual screen pixels? I found this very reliable: final scale = getContext().getResources().getDisplayMetrics().density;

Re: [android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2011-01-12 Thread Dianne Hackborn
The density and densityDpi is an abstract density bucket the device manufacturer has decided makes sense for their UI to run in. This is what is used to evaluate things like dp units and select and scale bitmaps from resources. The xdpi and ydpi are supposed to be the real DPI of the screen...

[android-developers] Re: How to get screen density in pixels-per-inch or equivalent

2010-12-31 Thread Phil Endecott
Thanks Kostya, this is just what I needed. On Dec 31, 12:42 pm, Kostya Vasilyev kmans...@gmail.com wrote: 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