Loading a floating point image using a redirect
I am trying to load image from url using glide. But the url is redirected to a different url and hence the image is not displayed.
Amazon s3 url and i am using glley integration
How can I deal with this redirect?
public class CustomCache implements GlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
try {
builder.setDiskCache(
new InternalCacheDiskCacheFactory(context, 41943040)
);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void registerComponents(Context context, final Glide glide) {
RequestQueue queue = new RequestQueue( // params hardcoded from Volley.newRequestQueue()
new DiskBasedCache(new File(context.getCacheDir(), "volley")),
new BasicNetwork(new HurlStack())) {
@Override public <T> Request<T> add(Request<T> request) {
request.setRetryPolicy(new DefaultRetryPolicy(60000, 1, 1));
return super.add(request);
}
};
queue.start();
glide.register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(queue));
}
}
+3
source to share
No one has answered this question yet
Check out similar questions: