UIL, Picasso - Images in adapter always reload when stop scrolling

谁说我不能喝 提交于 2019-12-03 12:26:18

If you're wondering how Facebook did it, they actually released their image loading library (https://github.com/facebook/fresco)

Is it possible you are actually calling notifyDataSetChanged on the underlying ListView at that time? Also are you using hasStableIds()?

For UIL you could try using a WeakMemoryCache (refer to https://github.com/nostra13/Android-Universal-Image-Loader/wiki/Useful-Info) as that'll theoretically allow you to make use of all available memory though it may cause a lot of extra GC calls.

For Picasso Taha's method looks like your best bet!

Maybe your memory cache size is small and Picasso tries to load images from disc cache. Please check here for deciding cache size. You can try to increase cache size of Picasso by:

Picasso p = new Picasso.Builder(context)
.memoryCache(new LruCache(cacheSize))
.build();

However in my opinion your app looks like having an endless feed. Which means your memory cache will be full at some time and you'll have to use disc cache. Retrieving data from the disc cache is slower compared to memory cache.

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