How to display only cache memory images in ViewPager using Universal Image Loader Android?

穿精又带淫゛_ 提交于 2019-12-14 04:25:11

问题


I want to display only those images that were loaded into cache memory once we downloaded from url using Universal Image Loader

Example

I have 15 URLS to download image and display inViewPager, but out of them only 5 were downloaded and i closed the app.. Now i don't have any internet connection to get all the other images from web, but app will show only 5 images and remaining pages will be blank..

Is is possible to get the list of only those images from cache Memory??

How can we restrict ViewPager from other blank pages?

I have successfully implemented Universal Image Loader, but got stuck on these issues.

Any idea/suggestion/sample would be appreciated..

Thanks


回答1:


You can define whether image was cached on disc using disc cache:

File cachedImage = imageLoader.getDiscCache().get(imageUrl);
if (cachedImage.exists()) {
    /// image is cached
}

You can check every image URL, define which images are cached and configure ViewPager appropriately.



来源:https://stackoverflow.com/questions/14073881/how-to-display-only-cache-memory-images-in-viewpager-using-universal-image-loade

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