0

I have an Activity that has a single ImageView on it, but it swaps the resourse out many times, cycling through several different high-resolution images.

I've been running into trouble with with "Bitmap Size Exceeds VM Budget" error. I've seen posts on here about manually cleaning things up in the onDestroy method, but the activity doesn't always get that far.

What can I do to cycle through a lot of big images without running out of memory?

Community
  • 1
  • 1
user605331
  • 3,718
  • 4
  • 33
  • 60

1 Answers1

0

I suggest recycle the bitmap of the imageView in onPause() method, and in onResume() load the image again.

Yashwanth Kumar
  • 28,931
  • 15
  • 65
  • 69
  • This did the trick. Reading around it sounds like manually calling recycle() on a BitMap should not be required, but making the call sure does work. In my case, I am calling it each time I change images and not on the onPause/onResume, but that's just a detail of my Activity's flow. – user605331 Jul 26 '12 at 16:58