Home > database >  How to create bitMap from imageUrl?
How to create bitMap from imageUrl?

Time:10-05

I would like to create bitmap from imageUrl. I have tried some solutions, but nothing works. How do you make it in Kotlin?

                    bitMap = Glide
                        .with(requireContext())
                        .asBitmap()
                        .load(imageUrlUri)

error

Type mismatch.
Required:
Bitmap?
Found:
RequestBuilder<Bitmap!>

CodePudding user response:

Try this:

bitMap = Glide
    .with(requireContext())
    .asBitmap()
    .load(imageUrl)
    .submit()
    .get()

CodePudding user response:

This method has been deprecated, but maybe help you:

bitmap = BitmapAsync().execute(your_image_url).get()!!

It will return you a bitmap.

  • Related