-hdpi or -xhdpi is not resolution, it's screen density - pixels per inch.

hdpi is 240 dpi
xhdpi is 320 dpi

mdpi is 160dpi, and is the reference density, at which dp's are same as
pixels

http://developer.android.com/guide/practices/screens_support.html

Images placed in -hdpi will be used as is without scaling on -hdpi devices
and will be scaled up on -xhdpi devices (taking 1,77 times more memory).
But on the other hand, higher density devices have higher per-app runtime
heap limits.

-- K

2012/7/16 user123 <[email protected]>

> As far I know each folder covers certain resolution range. If I save
> bitmaps in hdpi it will be used by devices considered as hdpi. Now, for a
> 480 x 800 device, it will not matter if I store there 480 x 800 bitmaps or
> let's say 700 x 1000. As far I saw in some tests I made, the bitmaps look
> the same, and the memory consumption is the same.
>
> But now if I don't have folders for higher resolution devices, and don't
> use compatibility mode, as far I understand (please somebody correct me if
> I'm wrong), the system will try to use the bitmaps from hdpi folder
> (right?). And there it will make a difference if the bitmaps are in 480 x
> 800 or 700 x 1000, because the system will scale the bitmaps assuming they
> are in hdpi size, and if they are actually already in xhdpi size (or near
> to it), then it will load a scaled, very big bitmap and this will consume a
> lot of memory.
>
> Saying this, because I had this problem with drawable and drawable-hdpi. I
> had erroneusly stored all the bitmaps, which were in hdpi resolution, in
> the drawable folder, instead the hdpi folder (hdpi folder was empty), so
> the hdpi devices scaled the bitmaps from the drawable folder (which were
> already in hdpi) resulting in enourmous bitmaps and out of memory errors.
>
> Not sure if I will get this problem again with hdpi and xhdpi... if yes, I
> can think about 2 solutions:
> 1. Disable the scaling for xhdpi using supports-screens tag in the
> manifest, this way enabling compatibilty mode.
> 2. Scale the bitmaps in hdpi down, so they fit exactly hdpi. But what is
> exactly hdpi? Which exact screen resolution should I refer in order to
> scale the  bitmaps?
>
> And 3, would be to create bitmaps for xhdpi but that's not a solution for
> me, since xhdpi is not explicitedly supported.
>
> 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 [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

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

Reply via email to