Deletion of drawing cache

后端 未结 2 1052
北恋
北恋 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.

    0 讨论(0)
  • 2021-01-21 11:57

    use bitmap.recycle(); before valuating your bitmaps to clear their cache before recreating it.

    0 讨论(0)
提交回复
热议问题