How to display only cache memory images in ViewPag

2019-05-09 10:21发布

问题:

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.