Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

So I have an ArrayList of objects that I need to be able to add to firebase when a new element is added to the ArrayList or an element in the ArrayList is changed. How would I push these changes up to firebase?

asked in CSC490_Spring2019 by (8 points)

2 Answers

+6 votes
Best answer

Ended up finding an answer here

Need a database reference
DatabaseReference database=FirebaseDatabase.getInstance().getReference(key);
Then put
Where key is the name of your variable and value is the value of your variable you are storing

answered by (8 points)
selected by
+3 votes

Expanding on Jared's answer, the command database.child(key).push().setValue(value); will add an additional value without replacing the data that is there. If you want to set that child to have a singular value, leave out the .push()

answered by (8 points)