I have a database like this:
{
"message" : "Hello, World!",
"reserva" : [ null, {
"codreserva" : 123,
"email" : "[email protected]",
"status" : "check in"
}, {
"codreserva" : 124,
"email" : "[email protected]",
"status" : "check out"
} ]
}
And I have a code to look up the reservation status:
public void ProcuraReserva(String codigodareserva){
// Read from the database
myRef = database.getReference("reserva/"+codigodareserva+"/status");
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String value = dataSnapshot.getValue(String.class);
textview1.setText("Status da reserva "+ value);
}
@Override
public void onCancelled(DatabaseError error) {
textview1.setText("Status com falha");
}
});
}
However, it looks for in ID
of my reservation wanted it to search according to CODRESERVA
. Could someone help me in this question to search according to my "line" in this database of Firebase
.