RE: [android-developers] Android DPI problems

2012-06-08 Thread Tommy Hartz
If I insert a picture will it come through on these posts? I am so confused
as to why this isn't showing up correctly on phones that say they have a
normal screen 

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Dianne Hackborn
Sent: Thursday, June 07, 2012 4:28 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Android DPI problems

 

You shouldn't be thinking about dpi at all.

 

You will currently encounter devices with only 5 densities: 120, 160, 213,
240, 320.

 

Every device will have one of those densities; 217dpi and 220dpi are not
valid densities.  You will care about this pretty much only for your
graphics, though the platform will scale your graphics if it does.

 

This is also relevant for text sizes and units used in layouts, but in those
cases you just use sp or dp units and it is taken care of for you.  So
for your layouts you should basically not care about densities at all, just
do your layouts in dp units as if you were on a medium density screen and
let the platform take care of it for you.

 

I strongly discourage the use of other units like in and mm -- many
devices do not report the correct true physical density, so you
unfortunately can't count on them working correctly.  Fortunately you
shouldn't need to, because 99% of the time you want to be operating in
density units not true dpi.

On Thu, Jun 7, 2012 at 12:44 PM, Tommy Hartz droi...@gmail.com wrote:

Hey everyone, I am a little confused on something. I have created multiple
layouts for different screen sizes. The problem I run into is that on my HTC
Inspire I have a normal screen with ~217dpi, on the droid X it reports to
have a normal screen but it has ~220 dpi. When I run my app it pulls the
right layout but the images on the screen have huge spaces in between them
yet on my HTC everything appears how it should. How can I avoid this issue?
It is incredibly frustrating.

--
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
mailto:android-developers%2bunsubscr...@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

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

2012-06-08 Thread RichardC
Post your layout, maybe we can spot something ...

On Friday, June 8, 2012 5:09:15 PM UTC+1, Tommy wrote:

 If I insert a picture will it come through on these posts? I am so 
 confused as to why this isn’t showing up correctly on phones that say they 
 have a “normal” screen 

  

 *From:* android-developers@googlegroups.com [mailto:
 android-developers@googlegroups.com] *On Behalf Of *Dianne Hackborn
 *Sent:* Thursday, June 07, 2012 4:28 PM
 *To:* android-developers@googlegroups.com
 *Subject:* Re: [android-developers] Android DPI problems

  

 You shouldn't be thinking about dpi at all.

  

 You will currently encounter devices with only 5 densities: 120, 160, 213, 
 240, 320.

  

 Every device will have one of those densities; 217dpi and 220dpi are not 
 valid densities.  You will care about this pretty much only for your 
 graphics, though the platform will scale your graphics if it does.

  

 This is also relevant for text sizes and units used in layouts, but in 
 those cases you just use sp or dp units and it is taken care of for 
 you.  So for your layouts you should basically not care about densities at 
 all, just do your layouts in dp units as if you were on a medium density 
 screen and let the platform take care of it for you.

  

 I strongly discourage the use of other units like in and mm -- many 
 devices do not report the correct true physical density, so you 
 unfortunately can't count on them working correctly.  Fortunately you 
 shouldn't need to, because 99% of the time you want to be operating in 
 density units not true dpi.

 On Thu, Jun 7, 2012 at 12:44 PM, Tommy Hartz droi...@gmail.com wrote:

 Hey everyone, I am a little confused on something. I have created multiple
 layouts for different screen sizes. The problem I run into is that on my 
 HTC
 Inspire I have a normal screen with ~217dpi, on the droid X it reports to
 have a normal screen but it has ~220 dpi. When I run my app it pulls the
 right layout but the images on the screen have huge spaces in between them
 yet on my HTC everything appears how it should. How can I avoid this issue?
 It is incredibly frustrating.

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


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

2012-06-07 Thread Tommy Hartz
Hey everyone, I am a little confused on something. I have created multiple
layouts for different screen sizes. The problem I run into is that on my HTC
Inspire I have a normal screen with ~217dpi, on the droid X it reports to
have a normal screen but it has ~220 dpi. When I run my app it pulls the
right layout but the images on the screen have huge spaces in between them
yet on my HTC everything appears how it should. How can I avoid this issue?
It is incredibly frustrating.

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

2012-06-07 Thread Dianne Hackborn
You shouldn't be thinking about dpi at all.

You will currently encounter devices with only 5 densities: 120, 160, 213,
240, 320.

Every device will have one of those densities; 217dpi and 220dpi are not
valid densities.  You will care about this pretty much only for your
graphics, though the platform will scale your graphics if it does.

This is also relevant for text sizes and units used in layouts, but in
those cases you just use sp or dp units and it is taken care of for
you.  So for your layouts you should basically not care about densities at
all, just do your layouts in dp units as if you were on a medium density
screen and let the platform take care of it for you.

I strongly discourage the use of other units like in and mm -- many
devices do not report the correct true physical density, so you
unfortunately can't count on them working correctly.  Fortunately you
shouldn't need to, because 99% of the time you want to be operating in
density units not true dpi.

On Thu, Jun 7, 2012 at 12:44 PM, Tommy Hartz droi...@gmail.com wrote:

 Hey everyone, I am a little confused on something. I have created multiple
 layouts for different screen sizes. The problem I run into is that on my
 HTC
 Inspire I have a normal screen with ~217dpi, on the droid X it reports to
 have a normal screen but it has ~220 dpi. When I run my app it pulls the
 right layout but the images on the screen have huge spaces in between them
 yet on my HTC everything appears how it should. How can I avoid this issue?
 It is incredibly frustrating.

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

RE: [android-developers] Android DPI problems

2012-06-07 Thread Tommy Hartz
Well all of my layouts are using dp to specify the width/height of the
images. Is there a way I can get what density the screen reports back to
android and drop it in a toast or something so I can see which of the 5 it
is? The phone that really gives me the issue is the Droid X. The dimensions
are nearly idendical as far as resolution but I guess the Droid X has a
higher density than the HTC Inspire.

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Dianne Hackborn
Sent: Thursday, June 07, 2012 4:28 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Android DPI problems

 

You shouldn't be thinking about dpi at all.

 

You will currently encounter devices with only 5 densities: 120, 160, 213,
240, 320.

 

Every device will have one of those densities; 217dpi and 220dpi are not
valid densities.  You will care about this pretty much only for your
graphics, though the platform will scale your graphics if it does.

 

This is also relevant for text sizes and units used in layouts, but in those
cases you just use sp or dp units and it is taken care of for you.  So
for your layouts you should basically not care about densities at all, just
do your layouts in dp units as if you were on a medium density screen and
let the platform take care of it for you.

 

I strongly discourage the use of other units like in and mm -- many
devices do not report the correct true physical density, so you
unfortunately can't count on them working correctly.  Fortunately you
shouldn't need to, because 99% of the time you want to be operating in
density units not true dpi.

On Thu, Jun 7, 2012 at 12:44 PM, Tommy Hartz droi...@gmail.com wrote:

Hey everyone, I am a little confused on something. I have created multiple
layouts for different screen sizes. The problem I run into is that on my HTC
Inspire I have a normal screen with ~217dpi, on the droid X it reports to
have a normal screen but it has ~220 dpi. When I run my app it pulls the
right layout but the images on the screen have huge spaces in between them
yet on my HTC everything appears how it should. How can I avoid this issue?
It is incredibly frustrating.

--
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
mailto:android-developers%2bunsubscr...@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

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

2012-06-07 Thread RichardC
In your Activity class

DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

The output some of the contents of displayMetrics




On Thursday, June 7, 2012 10:12:33 PM UTC+1, Tommy wrote:

 Well all of my layouts are using dp to specify the width/height of the 
 images. Is there a way I can get what density the screen reports back to 
 android and drop it in a toast or something so I can see which of the 5 it 
 is? The phone that really gives me the issue is the Droid X. The dimensions 
 are nearly idendical as far as resolution but I guess the Droid X has a 
 higher density than the HTC Inspire.

  

 *From:* android-developers@googlegroups.com [mailto:
 android-developers@googlegroups.com] *On Behalf Of *Dianne Hackborn
 *Sent:* Thursday, June 07, 2012 4:28 PM
 *To:* android-developers@googlegroups.com
 *Subject:* Re: [android-developers] Android DPI problems

  

 You shouldn't be thinking about dpi at all.

  

 You will currently encounter devices with only 5 densities: 120, 160, 213, 
 240, 320.

  

 Every device will have one of those densities; 217dpi and 220dpi are not 
 valid densities.  You will care about this pretty much only for your 
 graphics, though the platform will scale your graphics if it does.

  

 This is also relevant for text sizes and units used in layouts, but in 
 those cases you just use sp or dp units and it is taken care of for 
 you.  So for your layouts you should basically not care about densities at 
 all, just do your layouts in dp units as if you were on a medium density 
 screen and let the platform take care of it for you.

  

 I strongly discourage the use of other units like in and mm -- many 
 devices do not report the correct true physical density, so you 
 unfortunately can't count on them working correctly.  Fortunately you 
 shouldn't need to, because 99% of the time you want to be operating in 
 density units not true dpi.

 On Thu, Jun 7, 2012 at 12:44 PM, Tommy Hartz droi...@gmail.com wrote:

 Hey everyone, I am a little confused on something. I have created multiple
 layouts for different screen sizes. The problem I run into is that on my 
 HTC
 Inspire I have a normal screen with ~217dpi, on the droid X it reports to
 have a normal screen but it has ~220 dpi. When I run my app it pulls the
 right layout but the images on the screen have huge spaces in between them
 yet on my HTC everything appears how it should. How can I avoid this issue?
 It is incredibly frustrating.

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


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