How to fix “canvas: trying to use a recycled bitmap error”?

前端 未结 4 1632
轻奢々
轻奢々 2021-01-12 07:15

I\'m creating a RecyclerView to show a Grid of pictures. When selecting one of them, it should open a new activity with a transition.

I\'m using Glide l

4条回答
  •  有刺的猬
    2021-01-12 07:45

    I solved by adding this:

    Glide.with(activity).clear(view);
    

    before load the image:

    Glide.with(activity)
                    .load(imageUrl)
                    .apply(options)
                    .placeholder(R.drawable.loading_image)
                    .error(R.drawable.not_found)
                    .into(view);
    

    See docs:

    http://bumptech.github.io/glide/doc/resourcereuse.html

    http://bumptech.github.io/glide/doc/resourcereuse.html#cannot-draw-a-recycled-bitmap

提交回复
热议问题