Thursday, September 15, 2011

[android-developers] Re: Out Of Memory Error with Images loaded through XML

Presumably because he needs to recycle the switched out bitmap
immediately, rather than wait for Android to decide that it has time
to clean out the old bitmaps.

I've run into this issue a lot myself when working with largish
bitmaps. The GC for bitmaps is pretty rubbish - especially if your app
has to run on older phones.

Regards,

Michael A.

On Sep 15, 11:53 am, "Ralph Bergmann | the4thFloor.eu"
<ra...@the4thfloor.eu> wrote:
> Am 15.09.11 06:47, schrieb Sorab Pithawala:
>
> > I have made a ZIP file containing the code, XML and a small readme.
>
> Why do you do it that way:
>
> h1 = BitmapFactory.decodeResource(res, R.drawable.help1_l);
> ImageView im = (ImageView) findViewById(R.id.helpImage);
> im.setImageBitmap(h1);
>
> and not like this:
>
> im.setImageDrawable(getResources().getDrawable(R.drawable.help1_l))
>
> take also a look at:
>
> http://developer.android.com/resources/samples/ApiDemos/src/com/examp...
>
> Ralph

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment