I am using glide for load image in my application. Its working fine with my condition like
if(image_enabled==1){
Glide.with(getContext()).load(constant.SERVER_URL+"images/"+quoteData.get(KEY_PICTURE).apply(myOptions).into(mImageView);
}
else if(image_enabled==0){
Glide.with(getContext()).load(constant.SERVER_URL+"images/"+quoteData.get(KEY_PICTURE)).apply(myOptions).into(mImageView);
}
But I want load one more url if any above condition failed to load image. I do not know which method is for track load failed in glide. Let me know if any one can help me for get it. Thanks
I think this will help you. Just set your url in .error() it will load on failure.
Glide.with(getContext())
.load("your url")
.error("your default drawable")
.into(mImgProfile);
Or else you can use below as well
Glide.with(mActivity)
.load("your url")
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
return false;
}
})
.into(mImgProfile);
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