Reputation: 146
Based on this discussion: Universal Image Loader - Image URL 404 Error handling
I make Image Loader. It is work FINE! But in my case the image files deleted on the server by expired. I would like that the cached query URL 404 for this, but is not cached, and happens every time when i scroll down the listview in this pending image URL for get 404. How does it cache?
Upvotes: 1
Views: 443
Reputation: 3275
this is very late answer, but it will help others, the answer is simply explain here,
DisplayImageOptions options = new DisplayImageOptions.Builder()
.resetViewBeforeLoading(false).delayBeforeLoading(10)
.showImageOnFail(null).showImageForEmptyUri(null) // this will intitate null if there is loading fail or empty url
.cacheInMemory(true).cacheOnDisc(true).handler(new Handler())
.build();
And Handle 404 using this
ImgLoader.displayImage(Globals.Image_Domain + largeimageUrl,
largeImage, Base.options, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view,
FailReason failReason) {
// TODO Auto-generated method stub
// This will handle 404 and it will catch null exception
// do here what you want to do
}
@Override
public void onLoadingComplete(String imageUri,
View view, Bitmap loadedImage) {
// TODO Auto-generated method stub
if (largeImage == null)
return;
largeImage.setImageBitmap(loadedImage);
}
@Override
public void onLoadingCancelled(String imageUri,
View view) {
}
});
Upvotes: 2