Reusing the bitmap variable after recycle

后端 未结 3 948
刺人心
刺人心 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:38

    You can have check before recycling the bitmap, as like :

    if (img != null && !img.isRecycled()) 
                {
                    img.recycle();
                    img = null;
                    System.gc(); 
                }
    

    Here img is bitmap.

    Try this type error is sloved.

提交回复
热议问题