Reputation: 17
I'm new to Firebase and currently I'm making my project using Firebase as backend. But I'm having this issue. I have my Firebase database structure like this:-
root:
child1:
value1:
value2:
child2:
value1:
value2:
and so on. I want to edit/modify value2 under child 1. How can i do that. Any help would be appreciated.
Upvotes: 0
Views: 3444
Reputation: 3793
I was facing some issues when using the above code ,finally after modification i got my solutions .This will modify your matching child's inside value
NOTE
users
+child1-value1
+child2-value1
DatabaseReference dbrefrence= FirebaseDatabase.getInstance().getReference();
HashMap<String, Object> result = new HashMap<>();
result.put("username", "COMPLETED");
dbrefrence.child("users").child("child1").updateChildren(result);
Upvotes: 0
Reputation: 1925
DatabaseReference c1v2= FirebaseDatabase.getInstance().getReference().child("child1").child("value2");
c1v2.setValue("Value");
Please start here: https://firebase.google.com/docs/database/android/read-and-write
Upvotes: 5