I have a RecyclerView and each item of RecyclerView is having ImageView.
I am loading the image in that ImageView using Glide, when I scroll down the RecyclerView it loads images and this is fine, but when I again srcoll up the RecyclerView it again loads those images which are already been loaded. I do not want to load that images again which have already been loaded.
I am using the below code to load images using Glide
Glide.with(mActivity)
.load(img.getmGridViewImageUrl())
.into(imageHolder.imageView);
You can cache the images either on disk or in Memory.
By default images are cached in Memory by Glide
If you want to enable cache in disk you can use one of the following
DiskCacheStrategy.SOURCE caches only the original full-resolution
image.DiskCacheStrategy.RESULT caches only the final image, after reducing
the resolution (and possibly transformations)DiskCacheStrategy.ALL caches all versions of the image (default
behavior)Usage :
Glide
.with( context )
.load( url )
.diskCacheStrategy( DiskCacheStrategy.ALL )
.into( imageViewInternet );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With