Is it absolutely correct that Picasso understands NOT to load if the view has been recycled?

蹲街弑〆低调 提交于 2019-12-06 16:56:19

yes, Picasso is that beautiful. You only need that one line inside the getView() method Picasso.with(c).load(url).into(img);

how they exactly do it, I'm not sure, but before Picasso existed I did my own image loader and it's not so difficult.

Let's say you have a map of Url and ImageView somewhere in your image loader code.

So whenever the code pass img to it, it checks against this map, if it is already loading other URL for the same img using basic Java mImg.equals(img), if it matches, it knows that, even thou still will cache that URL, it should not deliver the Drawable to the ImageView.

There're a few rare cases that you might want to directly cancel a load, on those cases you can call Picasso.with(c).cancel(img);, but that's rare to be necessary.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!