How to Load Image into Imageview from Url Using Glide V4.0.0Rc1

How to load Image into ImageView from Url using Glide v4.0.0RC1

If you are using Glide v4.0.0-RC1 then you need to use RequestOptions to add the placeholder, error image and other option. Here is an working example

RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher_round);

Glide.with(this).load(image_url).apply(options).into(imageView);

How to download a image from url in recylerview?

Glide allows to load a Bitmap.

you can save Bitmap to file, and then just pass file path to another screen.

Here you can find detailed tutorial, how to store image to file with Glide library:

https://medium.com/@akshayranagujjar/how-to-save-image-to-storage-using-glide-in-android-fa26c842f212

And don't forget about storage permissions.

Failed to load image using glide

I tried using Glide v4.0.0-RC1 use RequestOptions to add the placeholder, error image and other options make sure URL(image_url) starts with https, not with HTTP

   RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.drawable.your_error_image);

RequestOptions to add placeholder, error image and to customize image

 Glide.with(this).load(image_url).apply(options).into(imageView);


Related Topics



Leave a reply



Submit