On Thu, Oct 11, 2012 at 5:36 PM, bob <[email protected]> wrote: > I'm trying to make a routine that gets the width and height of a device in > inches: > > Here's what I came up with: > > public void get_display_size() { > > DisplayMetrics metrics = new DisplayMetrics(); > getWindowManager().getDefaultDisplay().getMetrics(metrics); > float width_in = metrics.widthPixels / metrics.xdpi; > float height_in = metrics.heightPixels / metrics.ydpi; > > } > > Does this look good?
Yes, looks good, just keep in mind that some devices report incorrect values in xdpi & ydpi. -- 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

