0

I have to show about 40 bitmaps in a Gridview. each image is around 500k and total size is around 15MB. I am getting OutOfMemoryError in my getView() of Adapter. (I'm reusing the convertView).

How can I get rid of this error?

Siddharth Lele
  • 27,623
  • 15
  • 98
  • 151
Venkat Papana
  • 4,757
  • 13
  • 52
  • 74
  • How big are the bitmaps? Width and Height – Blackbelt Dec 05 '12 at 10:38
  • Why not use either the [Lazy Loader](https://github.com/thest1/LazyList) or the [Universal Image Loader](https://github.com/nostra13/Android-Universal-Image-Loader)? That will simplify the part where you have to deal with _Out Of Memory_ issues.... – Siddharth Lele Dec 05 '12 at 10:39
  • For the mobiles using API greater or equal to 11 you can use this tag in manifest at application lever :- android:largeHeap="true" – Ali Imran Dec 05 '12 at 10:41

1 Answers1

0

Your device do not support maintaining the 40bitmaps in memory. You should implement it loading only visibles imagenes.

If you don't know how to do it, you can use Android Universal Image Loader. This library will avoid outOfMemoryError and will simplify the load image task.

frayab
  • 2,512
  • 20
  • 25