Im having problem with caching image with Glide.
My sample code is like this.
items.forEach { item ->
Glide.with(context)
.asBitmap()
.apply(requestOptions)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.load(item.url)
.into(object : CustomTarget<Bitmap>() {
override fun onLoadCleared(placeholder: Drawable?) {
}
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap>?
) {
}
})
}
I want to cache the data in first for loop, and after first loop is over, the glide should not request to remote url, should use cache. I tested with the DiskCacheStrategy options, but it didn't work. Anyone who can solve this problem, please help me...