Deletion of drawing cache

后端 未结 2 1051
北恋
北恋 2021-01-21 11:24

In my app I want to swap images at runtime when user clicks on it.

there are two imageviews when user click on first image and then click on second image at the

2条回答
  •  北海茫月
    2021-01-21 11:55

    This is a sample e.g. where i use to Free the native object associated with this bitmap.

    Bitmap  bitmap;
    
    public Bitmap createBitmap(ImageView imageview) {
        if (bitmap != null) {
            bitmap.recycle();
            bitmap = null;
        }
        bitmap = Bitmap.createBitmap(imageview.getDrawingCache());
        // Your Code of bitmap Follows here
    }
    

    Before use of Bitmap just free the object.

提交回复
热议问题