No no no no no. getResources().getConfiguration() tells you this kind of stuff about the device.
Look for LARGE or XLARGE screen size, depending on what you want to do. And of course you can have your resources adjust automatically by using things like layout-xlarge. On Mon, Feb 21, 2011 at 6:09 AM, carlo <sazi...@gmail.com> wrote: > Thank you all > > Here is the code I use for my app: > > public boolean isTablet() { > try { > // Compute screen size > DisplayMetrics dm = > context.getResources().getDisplayMetrics(); > float screenWidth = dm.widthPixels / dm.xdpi; > float screenHeight = dm.heightPixels / dm.ydpi; > double size = Math.sqrt(Math.pow(screenWidth, 2) + > Math.pow(screenHeight, 2)); > // Tablet devices should have a screen size greater than 6 > inches > return size >= 6; > } catch(Throwable t) { > Log.error(TAG_LOG, "Failed to compute screen size", t); > return false; > } > } > > Any comments/suggestions? > > On 16 Feb, 12:07, carlo <sazi...@gmail.com> wrote: > > The question is simple... is there a (simple) way todetectif the > > current device, on which my application is running, is atablet? > > I know I could rely on the screen resolution, but I was wondering if > > there is a more deterministic way... > > > > Thanks in advance > > Carlo > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en