Home > other >  How to update Firebase real Time database a specific child node from android studio in kotlin langua
How to update Firebase real Time database a specific child node from android studio in kotlin langua

Time:06-08

this is my Firebase node real-time database structure i wan to update userProfilePic

I try my best but this is not being updated

here is my code

database.getReference().child("User").child(FirebaseAuth.getInstance().uid.toString())
                        .child("userProfilePic")
                        .setValue(uri)
                        .addOnSuccessListener { 

                        }
                        .addOnFailureListener {
                            Toast.makeText(this,it.message,Toast.LENGTH_SHORT).show()
                        }

please tell me how I can update in kotlin in android studio

CodePudding user response:

I think you should reconsider this snippet code

child(FirebaseAuth.getInstance().toString())

CodePudding user response:

You should refer to currentUser when calling for uid like this:

FirebaseAuth.getInstance().currentUser.uid

Instead of:

FirebaseAuth.getInstance().uid.toString()
  • Related