Reusing the bitmap variable after recycle

后端 未结 3 911
刺人心
刺人心 2021-01-29 01:15

I have recycled the bitmap variable and when I again tried to use the same variable I have some strange errors with reference to recycle. Any solution to this issue ?

j

3条回答
  •  无人及你
    2021-01-29 01:54

    Once you recycle the bitmap its memory is freed. That's mean that bitmaps data are gone from the memory. If you want to use again the same variable you have to decode the Bitmap againg .

    if (image1 == null || image1.isRecycled()) {
        image1 = BitmapFactory.decodeStream()
    }
    

提交回复
热议问题