> private Bitmap loadBitmap(int resId) { BitmapFactory.Options options = new
> BitmapFactory.Options(); options.inTargetDensity = 1; options.inDensity = 1;
> return BitmapFactory.decodeResource(context.getResources(), resId, options);
> }

That's the wrong way to do it. You're assigning your bitmap a density
of 1dpi, which can have bad consequences. There's a much simpler way
to do it: just set options.inScaled = false.

But the right way to do it really is to place the assets in the right directory:
drawable-ldpi/ for 120dpi displays
drawable-mdpi/ for 160dpi displays
drawable-hdpi/ for 240dpi displays

and in your case:
drawable-nodpi/ for assets that should not be scaled.

> I have two related queries:
> Is there a simpler way of doing this?
> Is there a way to support android:minSdkVersion="3" without jumping through
> the hoop of creating two implementations (for API 3 and API 4) of an "image
> loading" interface and selecting one at runtime?
> Tom.
> >
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

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

Reply via email to