Thanks, Mark. That seems to work. I'm using this:
float pixels_per_X_inch = displayMetrics.xdpi;
float pixels_per_Y_inch = displayMetrics.ydpi;
if(Build.DEVICE.equals("sholes") && Build.MODEL.equals("Droid"))
{
pixels_per_X_inch = 264; // 480/(9*3.7/sqrt(337)) = 264.613474
pixels_per_Y_inch = 264; // 854/(16*3.7/sqrt(337)) = 264.820203
}
The 3.7 is the diagonal of the screen in inches (from the device
specification). It's supposed to be a 16:9 display with a resolution
of 480x854. If somebody knows for certain what the device should
return for the xdpi/ydpi, please, post it. I'm sure that 3.7 inches
is not exact, so maybe I'm off by a few pixels, but for sizing my
tiles to 1 cm it works quite well.
On Aug 9, 4:48 pm, Mark Murphy <[email protected]> wrote:
> On Mon, Aug 9, 2010 at 7:24 AM, Rob <[email protected]> wrote:
> > How do I detect what hardware my app is running on? I mean the
> > specific brand and model.
>
> android.os.Build has that information.
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
> Available!
--
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