Detecting DPI?

Is there an easy way to detect DPI? I need to layout icons slightly different depending on DPI. I can't just looked at the model since on Android there are so many, and I can't just look at the resolution since 1280x800 on a Galaxy Tab 10.1 is much lower DPI than 960x640 on an iPhone4.

There's no way to do that at present, however could you consider checking for device for iPhone4 and checking screen res for others?

Since I want to run on Android this won't be possible, since there are dozens of HDPI Android handsets with DPI similar to the iPhone4. There'd be no way for me to differentiate between 1024x600 of the Nook Color/GTab (MDPI) vs. the 960x640 of an iPhone 4 (HDPI) or the 1024x768 (LDPI) of an iPad.

In my particular case the screen layout depends heavily on DPI since it corresponds to legibility (I need to provide somewhat fixed size UI elements in physical space, not in pixels).

My alternative is to provide two different apps, one that is for phones and one that is for tablets. That's not the end of the world, it's just somewhat inconvenient since the ONLY difference would be the layout.

views:1650 update:2011/9/27 8:54:05
corona forums © 2003-2011