FastAdapter: possible bug: duplicate images when scrolling
Details
- [ ] Used library version 3.2.5
- [ ] Used support library version 27.1.1
- [ ] Used gradle build tools version 3.1.3
- [ ] Used tooling / Android Studio version 3.1.3
About this issue
i am not sure if this is a bug in the library or somewhere else or if im somehow missing something… the issue is that some views do not seem to be binded/unbinded properly and i am getting duplicate images. here is an example:

as you can see, “Madam Secretary” and “Nashville” have the same image. this seems to be happening at random - if i scroll up and down a few times, this would happen to different items.
things to note (in case they matter):
- i am using kotlin
- i am using ModelAdapter
- the adapter is filtered while this is happening
here are my bindView and unbindView:
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>)
{
super.bindView(holder, payloads)
val view = holder.view
val context = view.context
Picasso.with(context)
.load(model._imageUrl)
.placeholder(R.drawable.image_loading)
.error(R.drawable.image_error)
.fit()
.centerInside()
.into(view.iv_showImage)
(view as FrameLayout).foreground =
FastAdapterUIUtils.getSelectablePressedBackground(context,
context.resources.getColor(R.color.colorPrimaryTransparent),
255,
true)
val nameAndYear = "${model._name}\n(${model._year})"
view.tv_nameAndYear.text = nameAndYear
if (model.isRunning())
view.tv_status.visibility = View.GONE
else
view.tv_status.apply {
visibility = View.VISIBLE
setText(R.string.showEnded)
}
}
override fun unbindView(holder: ViewHolder)
{
super.unbindView(holder)
holder.view.apply {
tv_status.text = ""
tv_nameAndYear.text = ""
iv_showImage.setImageDrawable(null)
}
}
Things i have tried (inside unbindView method)
i found a few suggested solutions on StackOverflow but none of them work for me
imageView.setImageDrawable(null)imageView.setImageBitmap(null)imageView.setImageResource(0)imageView.setImageResource(android.R.color.transparent)
up until today imageView.setImageDrawable(null) has been working just fine but not anymore for some reason…
is my code wrong somehow? is anybody else experiencing this issue?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (21 by maintainers)
Call Picasso.get().cancelRequest(imageView); in unbind