I am having an issue with bitmap recycle. I am displaying the bitmaps in a pulltorefreshlistview. I have about 30-50 Images to download alongwith some text from webservice function. I am using lazyloading of images and downloading Images and decoding them to 80x80 size. My Issue is that I am getting OutOfmemoryError. So I done some R and D and know that bitmaps were not GC'd immediately. So I want to do recycle() the bitmaps for reclaiming the memory. where to call recycle() on bitmaps. I am using famous lazylist. in this below code after setting bitmap, i tried to do bitmap.recycle(). I haven't got any error like other reported on stackoverflow but strange thing is listitems are shown blank. I wonder that if I recycle() bitmap why the textviews, in the same row are effected. As there are big number of images my app crashing very soon. I would also like to ask how to recycle all the images set in Listview at a time. please some one help me.
//Used to display bitmap in the UI thread
class BitmapDisplayer implements Runnable
{
Bitmap bitmap;
PhotoToLoad photoToLoad;
public BitmapDisplayer(Bitmap b, PhotoToLoad p){bitmap=b;photoToLoad=p;}
public void run()
{
if(imageViewReused(photoToLoad))
return;
if(bitmap!=null)
photoToLoad.imageView.setImageBitmap(bitmap);
else
photoToLoad.imageView.setImageResource(stub_id);
}
}