I want to retrieve the profile image of the user(URL). The user could have set image or not. So if the image field is empty, I get an exception. How could I check beforehand that image field is empty and I avoid crashing the app
firebaseFirestore.document("users/profiles/data/"+ad_poster_id).get().addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) { if(task.getResult().exists()){
String profile_image = task.getResult().getString("image");
if(profile_image!=null)
Picasso.get().load(profile_image).into(circleImageView);
}
}
});