1

I created an arraylist for bitmaps and then i want to remove a single bitmap from arraylist when a button is clicked. I used this for clearing bitmap

DELETE.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            bitmapArray.get(0).recycle();

        }
    });

But this doesnt seem to work . it does not remove the bitmap. Please suggest me something else.

Sandeep R
  • 2,284
  • 3
  • 25
  • 51

2 Answers2

2

Add this line after..

bitmapArray.get(0).recycle();

you are just recycling but not removing the bitmap object from the list..

bitmapArray.remove(0);
kalyan pvs
  • 14,486
  • 4
  • 41
  • 59
2

Try calling bitmapArray.remove(0); after bitmapArray.get(0).recycle();

Sunny
  • 14,522
  • 15
  • 84
  • 129