I have a recyclerview
with diffutil
. Already I using Glide
to load images inside the ImageViews
.
on the onBindViewHolder
I call my function it's called loadImage(holder.view,item)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = getItem(position)
onLoadImage(holder.view, item)
}
In my loadImage I load the image inside the view.
private fun loadImage(view: View, item: MyItemModel) {
Timber.i("load item's image id: ${item.id} image is: ${item.image}")
Glide.with(context)
.asDrawable()
.load(item.image)
.into(view.main_image)
}
It works good, but when first time when It's loading the image than I swipe in the list, and the Images are shows like this:
So the Images are duplicated, but the last two image is different. It happens only if I swipe fast when It's loading. Log:
I/MyListAdapter: load image into : 6 image is: [B@25d0674
I/MyListAdapter: load image into : 7 image is: [B@e64ced4
I/MyListAdapter: load image into : 8 image is: [B@b384734
This is a Custom View. Context is that's view's context.
So the Images are different. What is the problem?
Any suggestion?