The main question:
What is the most efficient lossless method for lazily loading remote images into a simple ListView adapter that uses the ViewHolder template?
I currently have an implementation that will first check the Bitmap HashMap SoftReference for the soft image cache version. If this fails, I will check my hard cache for a copy of the image. If this fails, I get it from the Internet. I do all this in a separate thread and in a queue to exclude simultaneous or duplicate downloads.
The problem is loading via callback. Since I use the ViewHolder template, my views are constantly being refined, and I have not found a reliable way to eliminate various images accidentally attached to my ImageViews. I make a default image by default before each load, but since the views are processed so quickly that the "old" listeners are applied to my ImageView, providing the wrong image, which is then replaced with the correct image.
The only semi-solid solution I found was to use ViewHolder itself as a listener, but that only makes the problem less obvious. This still happens when scrolling fast.
Any help would be appreciated.
Update:
https://github.com/DHuckaby/Prime
HandlerExploit
source share