Recycling ImageView Bitmaps

I encountered memory issues when displaying large jpegs (in series) in a slideshow-like activity. I learned that you need to recycle the bitmaps with a call to recycle():

ImageView img;
Bitmap bitmap = ((BitmapDrawable) img.getDrawable()).getBitmap();

Note that ‘imgID’ is an array of resource IDs.

Published in: on January 18, 2012 at 6:26 pm  Leave a Comment  

The URI to TrackBack this entry is:

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: