You should implement your own ImageDownloader
(it's better to extend BaseImageDownloader
) which will handle this case. It should check if auth is required and it is then it makes re-query.
Using UniversalImageLoader with authorization
-
27-09-2022 - |
Pergunta
In my app, some of images are protected by authorization layer.
Downloading process is:
- Try download image from uri
- If failed on authorization get authorized uri and try again.
The problems are:
- There are no retry method, so I cannot try again with new uri
- Images are cached by uri (?) so I cannot save image from authorized uri as it was from base not authorized uri, so my authorized images will always be redownloaded.
Is there any way to resolve it in some simple way?
Solução
Outras dicas
loader.displayImage(beans.get(position).getImagePath(), holder.imageView, options,
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
//try again here with another URI.
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
// TODO Auto-generated method stub
}
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow