Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using android studio 4.1.1 with Kotlin. I'm learning myself how to do android programming with Kotlin.

I'm trying to update records in my database.

my test firebase db

In my code I'm doing this:

val ref = FirebaseDatabase.getInstance().getReference("weights").child(userId).child(weight.recordID.toString())
println("!!!!!!!!!!! Firebase reference: ${ref.toString()}")


ref.child("comments").setValue(weight.comments.toString())
ref.child("date").setValue(weight.date.toString())
ref.child("exerciseText").setValue(weight.exerciseText.toString())
...

My println shows: ...I/System.out: !!!!!!!!!!! Firebase reference: https://my-test-app-860ca-default-rtdb.firebaseio.com/weights/oB3pzvhAr6foyhGZUuvFl4CECOw2/-MQTjdSW6TkJkDTzOKlv

That looks correct - matches the record I'm testing: userID and recordID in Firebase web console.

The setValue() code matches what I see in the Firebase docs: https://firebase.google.com/docs/database/android/read-and-write under setValue(). I've verified via println's that the values I'm passing in are present

I'm not seeing the records update in my list in my app or in the Firebase web console.

Any ideas what I'm missing? Is there some other command I have to run to actually commit the changes?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
205 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...