I am trying to load images to the bitmaps using UIL. I need to load multiple images and I have noticed that in some cases image urls can be the same. And in such cases only first image is loaded. How to avoid request cancelling in UIL?
Code is run 3 times in the loop:
ImageSize targetSize = new ImageSize(70, 70);
ImageLoader.getInstance().loadImage("http://icons.iconarchive.com/icons/yellowicon/game-stars/256/Mario-icon.png", targetSize, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
Log.e("tag", "onLoadingStarted");
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
Log.e("tag", "onLoadingFailed");
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
Log.e("tag", "onLoadingComplete");
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
Log.e("tag", "onLoadingCancelled");
}
});
Logs are:
onLoadingStarted
onLoadingStarted
onLoadingStarted
onLoadingComplete
onLoadingCancelled
onLoadingCancelled
UIL cancels previous displayImage(...)
task for the same ImageView.
UIL cancels previous loadImage(...)
task for the same URL.
Actually for both cases UIL operates with ImageAware
s inside and compare ImageAware.getId()
to decide to cancel task or not.
In your case to prevent task cancelling you can do like this:
ImageSize targetSize = new ImageSize(70, 70);
ImageAware imageAware = new NonViewAware(targetSize, ViewScaleType.CROP);
ImageLoader.getInstance().displayImage("http://icons...", imageAware, ...);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With