1

This occur when try to draw canvas from imageView which using Coil to load image.

Could you help me solve problem? Thank you all

 fun loadImageFromUrl() {
        bodyImageView?.load(imagePathServer)
    }

This is code for draw bitmap from imageview

fun getBitmapFromView(view: View?): Bitmap? {
        var bitmap =
            Bitmap.createBitmap(view!!.width, view.height, Bitmap.Config.ARGB_8888)
        var canvas = Canvas(bitmap)
        view.draw(canvas)
        return bitmap
    }

Problem is shown

l

Duong.Nguyen
  • 373
  • 3
  • 13

1 Answers1

3

And I found a way to solve problem that just add allowHardware(false) in side load image and it worked. This is description why crash happed.

   bodyImageView?.load(imagePathServer) {
            allowHardware(false)
        }
Duong.Nguyen
  • 373
  • 3
  • 13