Reputation: 13803
I am trying to download image using the code below:
Glide.with(recommendedEventViewHolder.itemView)
.load(currentEvent.posterDownloadPath)
.diskCacheStrategy( DiskCacheStrategy.AUTOMATIC )
.into(recommendedEventViewHolder.posterImageView)
but the result is like this, in this video: https://drive.google.com/file/d/1ljGxwsi0wpaZbBY_CLmczdBzD9krz4QQ/view?usp=sharing
when I scroll down to the bottom of recycler view, and then go back to the top, the first image disappear and it seems re download the image
I have tried to remove the diskStartegy to be something like this:
Glide.with(recommendedEventViewHolder.itemView)
.load(currentEvent.posterDownloadPath)
.into(recommendedEventViewHolder.posterImageView)
but the result is just the same. I am using this in my gradle file
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
Upvotes: 1
Views: 487
Reputation: 3469
Change your diskCacheStrategy from DiskCacheStrategy.AUTOMATIC
to DiskCacheStrategy.onlyRetrieveFromCache(true)
, this will only try to send request only if images failed to cache.
Upvotes: 2