Hello , I would like to get a child value in firebase , add number and update child strong> with the result of the sum.
Code in 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 publishing in database
result = (textoT + 10);
uDataBase.setValue(result);
Thank you in advance.