protected void onCreate(Bundle savedInstanceState) {
ImageView iv = (ImageView)findViewById(R.id.iv_image);
// url is a http resource, which does not exist,so it shows ic_default.
Glide.with(this).load(url).placeholder(R.mipmap.ic_default).centerCrop().into(iv);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK) {
// returned from system gallery view.
bmHead = data.getExtras().getParcelable("data");
((ImageView)findViewById(R.id.iv_image)).setImageBitmap(bmHead);
}
}
after selected image from system gallery view, and return to this activity; the selected image will not displayed in R.id.iv_image. and we got a log from http server, the url(in onCreate function) is requested again after onActivityResult.
how to prevent this?pls help.
I guess , you just need to pause the request in onPause and onResume dont resume it .
tried, but that did not work. Thanks
fixed by calling Glide.clear(imageView) before setImageBitmap.
What do you mean by the url doesn't exists? 404? timeout?
What you experienced sounds like Glide is re-trying an already failed load.
I have used CircularProgressDrawable as a placeholder on recyclerview items. Once I go to next activity and come again on previous one, glide tries to load again previously failed images (Observe loader again on recyclerview items).

Please help me out if we can restrict glide to reload image if activity resumed.
@LaxmikantMahamuni Glide will retry load failures, there isn't currently a way to configure this behavior. You may be able to get around it by using Glide.with(applicationContext), but doing so will give up the rest of Glide's lifecycle integration as well.
@sjudd Thanks, for your valuable reply... I was using _RequestListener_ for showing error-image with error-text simultaneously. Now I have created a drawable using canvas as solution for simultaneously showing error-image with error-text. By using this drawable in .error() method instead of RequestListener.
Most helpful comment
@LaxmikantMahamuni Glide will retry load failures, there isn't currently a way to configure this behavior. You may be able to get around it by using Glide.with(applicationContext), but doing so will give up the rest of Glide's lifecycle integration as well.