How do I detect what hardware my app is running on? I mean the specific brand and model. I'm having the same problem with Droid. I wanted to manually size tiles at runtime to a minimum of 1cm, but it's not working because of this inaccurate value. Also, are you aware of any other devices that misreport their screen metrics? If so, will you provide a list?
Thanks. On Aug 6, 3:33 am, Dianne Hackborn <[email protected]> wrote: > Yes the current software on Droid reports the wrong value. Hopefully this > is fixed soon. :) > > > > On Fri, Aug 6, 2010 at 12:24 AM, Kostya Vasilyev <[email protected]> wrote: > > > 96 dpi is certainly wrong for Moto Droid / Milestone. > > > Try using Canvas.getDensity(). > > > -- Kosyta > > > 06.08.2010 5:14, sdphil пишет: > > > bump > > >> On Aug 4, 2:12 pm, sdphil<[email protected]> wrote: > > >>> I am trying to determine the physical size of a screen in inches. > > >>> Normally, I could do something like this: > > >>> DisplayMetrics metrics = new DisplayMetrics(); > >>> getWindowManager().getDefaultDisplay().getMetrics( metrics ); > > >>> Then use metrics.widthPixels and metrics.heightPixels. Now that I > >>> know the width and height in pixels, I should be able to calculate > >>> size in inches if I know the density. Easy enough, metrics.xdpi and > >>> metrics.ydpi. > > >>> Then screen dimension in inches should be: > > >>> widthInInches = metrics.widthPixels / metrics.xdpi; > >>> heightInInches = metrics.heightPixels / metrics.ydpi; > > >>> Seems simple enough except that it doesn't work. > > >>> On a Motorola Droid, the system reports back: xdpi and ydpi as 96 > >>> (which cannot be true). > > >>> And the screen resolution as: 480 x 854. Which results in a width of > >>> 5" x 8.9" -- which as I'm holding this in my hand right now, I must > >>> say - cannot be correct. > > >>> Any ideas on how to accurately calculate this? > > > -- > > Kostya Vasilev -- 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]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- 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

