Hi,

You do not need to do this since the framework will resize the bitmaps
for you automatically if their density does not match the screen's.

On Thu, Nov 26, 2009 at 8:03 AM, Joshua Frank <[email protected]> wrote:
> Is there a way to detect whether a image was pulled from the folder
> res/drawable or res/drawable-hdpi?
>
> I am trying to save space and have a program that is using some hdpi
> bitmaps and some mdpi bitmaps. When an image is placed in
> drawable-hdpi it automatically replaces the mdpi version. I need to
> know when this happens beacuse I am using bitamp.resize() to fix the
> image sizes.
>
> I have tried this --
>
>        //resize art
>                count = artBitmaps.length;
>                for(int i = 0; i < count; i++){
>                        if(artBitmaps[i] != null && artBitmaps[i].getDensity() 
> != getScreenDPI()){
>                                newW = (int) (artBitmaps[i].getWidth() * 
> xScale);
>                                newH = (int) (artBitmaps[i].getHeight() * 
> yScale);
>                                artBitmaps[i] = resizeBitmap(artBitmaps[i], 
> newW, newH);
>                        }
>                }
>
> The problem is that the getDensity() method (in the if statment after
> the && ) returns the screen density and I need the original bitmap
> density. This allays matched the screenDPI and returns false. I have a
> lot of artwork and do not want to duplicate everything for every size
> screen. I am trying to just create hdpi bitmaps for the ones that
> don't look good when re-sized.
>
> --
> Joshua Frank
>
> --
> 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
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  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 [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