Question

In my app, some of images are protected by authorization layer.

Downloading process is:

  1. Try download image from uri
  2. If failed on authorization get authorized uri and try again.

The problems are:

  1. There are no retry method, so I cannot try again with new uri
  2. 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?

Was it helpful?

Solution

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.

OTHER TIPS

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

                    }
                });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top