-4

Following is my android firebase example structure.

firebase example structure

I know only groupID and userID, I want to update specific total value by based on groupID and userID. i have no idea please help me.

  • 1
    Possible duplicate of [How to update a specific node from a Firebase database with Android?](https://stackoverflow.com/questions/41731924/how-to-update-a-specific-node-from-a-firebase-database-with-android) – ADM Dec 20 '17 at 05:56
  • My question is different, i want to retrieve/filter data first which node child has that groupID and userID then for that child i want to update total. – Chethan Kumar V Dec 20 '17 at 06:03
  • To retrieve you can use Firebase query . Whats the issue .have you tried . Post the code here . – ADM Dec 20 '17 at 06:06
  • I know retrieve. I need to update firebase child – Chethan Kumar V Dec 20 '17 at 06:16

1 Answers1

1

I understand your confusion :

Let me explain you : For updating single value :

//For this you just need your node Id

databaseReference = FirebaseDatabase.getInstance().getReference().child("useramounts").child("your_node_id");

 HashMap<String, Object> result = new HashMap<>();
 result.put("total", total);
 databaseReference.updateChildren(result);
Nikhil Lotke
  • 605
  • 7
  • 15
Abubakker Moallim
  • 1,610
  • 10
  • 20