2
Hello, Would like to get the value of a Child at firebase, add a number and update Child with the result of summing up.
Code on the Oncreate()
uDataBase = FirebaseDatabase.getInstance().getReference().child("Bilhetes").child("total");
uDataBase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
int total = dataSnapshot.getValue(int.class);
textoT = total;
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
Code published in the database
result = (textoT + 10);
uDataBase.setValue(result);
Thanks in advance.