I am using relativelayout to set an image.Why I hadn\'t using imageview means, inside relativelayout image, I am setting icons.
I dont know what is the issue exactly
Setup Glide with a parameter which has the correct lifecycle. For example: use Glide.with(this)
instead of Glide.with(getContext())
in a custom view.
Try this before load your image with Glide, in my case mirefer is a StorageReference, miimagen is a ImageView. I solved this problem, with this. I hope it could help you.
if (!this.isFinishing ()) {
// Load the image using Glide
Glide.with(YourActivity.this)
.using(new FirebaseImageLoader())
.load(mirefer)
.into(miimagen);
}
Please do not use Glide.with(getApplicationContext())
unless you really need to, for reasons discussed here:
Glide image loading with application context
The correct answer is outlined here: https://github.com/bumptech/glide/issues/1484#issuecomment-365625087
In Kotlin, that can be written as an extension function:
fun Context.isValidGlideContext() = this !is Activity || (!this.isDestroyed && !this.isFinishing)
the other way is to check if the activity is destroyed or not, then load into UI element.
if (!newActivty.isDestroyed()){
...
}