Re: [android-developers] Android devices and use of MM/INCH

2012-08-30 Thread Thesalan
You're right...

This is the config of DisplayMetrics of One X:
xdpi = 240
widthPixels = 480

We can deduce that the screen have a width of 2 inches... but in real - 
2,25 inches

So, is there a solution to determine this automatically? Or is it 
impossible to have real mesure on all devices?


Le mardi 28 août 2012 16:06:06 UTC+2, Latimerius a écrit :

 On Tue, Aug 28, 2012 at 3:07 PM, Thesalan thes...@gmail.com javascript: 
 wrote: 
  For a project, I have to use real size, like millimeters and inches. But 
 on 
  some devices, these values are false! 
  
  I have tested on some devices, and it appears that on HTC One X and HTC 
  Wildfire, 10mm = 11/12mm... But on Nexus One, Nexus S, Galaxy S2 these 
 sizes 
  are right! 
  
  To do this, I use this code : 
  
  float pxCm = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 10, 
  
  r.getDisplayMetrics()); 
  
  
  Someone have already encounter this problem? If yes, how have you bypass 
  this? 

 One thing I noticed is that devices can lie about their DPI.   For 
 instance, LG P500 states it has a 160 dpi screen but if you measure 
 the screen and do the maths, it's actually 180 dpi.  Correspondingly, 
 if you compute your pixel sizes based on the 160 dpi figure to get a 
 specified physical size (in mm), it will come out smaller. 

 I'd compute the actual DPI One X and Wildfire have and compare that to 
 figures in DisplayMetrics. 


-- 
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

[android-developers] Android devices and use of MM/INCH

2012-08-30 Thread Latimerius
On Thu, Aug 30, 2012 at 2:37 PM, Thesalan thesa...@gmail.com wrote:
 You're right...

 This is the config of DisplayMetrics of One X:
 xdpi = 240
 widthPixels = 480

 We can deduce that the screen have a width of 2 inches... but in real -
 2,25 inches

That's your explanation then - if the screen is physically bigger by
12.5% than it should, everything on the screen will come out bigger by
the same amount.  So your desired 10 mm becomes 12.5 mm.

 So, is there a solution to determine this automatically? Or is it impossible
 to have real mesure on all devices?

Unfortunately, I'm aware of no work-arounds.  Perhaps somebody else is...

I think the cause might be that manufacturers don't bother to fill in
actual densities for their screens.  240 dpi is used to represent the
hdpi range, 160 dpi (wrongly reported by my LG) is the typical density
for mdpi.  I believe they are used as defaults and never changed to
match the actual screen.

-- 
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


[android-developers] Android devices and use of MM/INCH

2012-08-28 Thread Thesalan
For a project, I have to use real size, like millimeters and inches. But on 
some devices, these values are false!

I have tested on some devices, and it appears that on HTC One X and HTC 
Wildfire, 10mm = 11/12mm... But on Nexus One, Nexus S, Galaxy S2 these 
sizes are right!

To do this, I use this code :

float pxCm = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 10,

  r.getDisplayMetrics());


Someone have already encounter this problem? If yes, how have you bypass 
this?


Thanks in advance

-- 
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

Re: [android-developers] Android devices and use of MM/INCH

2012-08-28 Thread Latimerius
On Tue, Aug 28, 2012 at 3:07 PM, Thesalan thesa...@gmail.com wrote:
 For a project, I have to use real size, like millimeters and inches. But on
 some devices, these values are false!

 I have tested on some devices, and it appears that on HTC One X and HTC
 Wildfire, 10mm = 11/12mm... But on Nexus One, Nexus S, Galaxy S2 these sizes
 are right!

 To do this, I use this code :

 float pxCm = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 10,

 r.getDisplayMetrics());


 Someone have already encounter this problem? If yes, how have you bypass
 this?

One thing I noticed is that devices can lie about their DPI.   For
instance, LG P500 states it has a 160 dpi screen but if you measure
the screen and do the maths, it's actually 180 dpi.  Correspondingly,
if you compute your pixel sizes based on the 160 dpi figure to get a
specified physical size (in mm), it will come out smaller.

I'd compute the actual DPI One X and Wildfire have and compare that to
figures in DisplayMetrics.

-- 
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