Assuming that you have the same database structure as in this question please use the following code:
final DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
yourButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
rootRef.child("Drivers").child(driverId).child("carNumber").setValue("newCarNumber");
}
});
In which driverId
is the id of the particular driver for which you want to make updates.
For the other fields just change carNumber
with cardType
, dateOfBirth
, name
or surname
.
If you want to update data for the last driver for example, use this line:
rootRef.child("Drivers").child("-Kv6q2beyS50VCxxX3M7").child("carNumber").setValue("newCarNumber");