0
I’m using Firebase Storage to store a user profile photo, I made a method to search the image and place it in an Imageview. It works very well when the image exists in Firebase, but when it doesn’t exist, it leaves Imageview with nothing, it doesn’t even show the default image I put in XML. How do I treat when the method does not return an image?
private void buscarFotoPerfil(String idUsuario) {
try {
storage = ConexaoFirebase.getStorageReference()
.child("images/perfil/" + idUsuario + ".jpg");
Glide.with(this)
.using(new FirebaseImageLoader())
.load(storage)
.into(imagePerfil);
} catch (Exception e) {
Toast.makeText(this, "Erro ao carregar foto do perfil." + e, Toast.LENGTH_SHORT).show();
}
}
Solved my problem 100%, thanks anyway!
– Eduardo Henrique
@Henriqueedu if the answer helped solve your problem, if you want you can validate it. If there are any more questions, I’m here.
– viana