Downloading a URL into an ImageView
is very easy using Glide:
Glide
.with(context)
.load(getIntent().getData())
.placeholder(R.drawable.ic_loading)
.centerCrop()
.into(imageView);
I'm wondering if I can download into a Bitmap
as well? I'd like to download into a raw bitmap that I can then manipulate using other tools. I've been through the code and don't see how to do it.
Best Answer
Make sure you are on the Lastest version
implementation 'com.github.bumptech.glide:glide:4.10.0'
Kotlin:
Bitmap Size:
if you want to use the original size of the image use the default constructor as above, else You can pass your desired size for bitmap
into(object : CustomTarget<Bitmap>(1980, 1080)
Java:
Old Answer:
With
compile 'com.github.bumptech.glide:glide:4.8.0'
and belowFor
compile 'com.github.bumptech.glide:glide:3.7.0'
and belowNow you might see a warning
SimpleTarget is deprecated
Reason:
The
SimpleTarget
still can be used as long you make sure you are not using the bitmap once the imageView is cleared.