I want to call a function where drawableprofile is binding as a profile icon. I want to call it when "imageUrl" child doesn’t exist.
val uid = firebaseAuth.currentUser?.uid
if (uid != null) {
database.child(uid).get().addOnSuccessListener {
if (it.exists()) {
val fetchimg = it.child("imageUrl").value
Glide.with(this).load(fetchimg).into(binding.profileIcon)
} else if {
database.child(uid).child("imageUrl")
val drawableprofile = resources.getDrawable(R.drawable.ic_person)
Glide.with(this).load(drawableprofile).into(binding.profileIcon)
}
}
}
I can’t find any .isNull function etc. Thanks for help
2
Answers
According to your last comment:
Since you’re using Glide for Android to display your images, then you can simply call Glide#placeholder() like this:
Replace your code with the following: