Search by name with firebase in android

Viewed 3031

I have a problem several days ago and I don't find a solution.

I´m trying search in my firebase database by name but the result is always null.

The database is the next;

database

The code that I use is the next;

final String nombre = edtNombreJugador.getText().toString().trim().toUpperCase();

mDatabase.child("user").child("personalData").orderByChild("name").equalTo(nombre);

mDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {

for (DataSnapshot singleSnapshot : dataSnapshot.getChildren()){

String title = (String) singleSnapshot.child("name").getValue(String.class);
System.out.println("TITLE: "+title);


 }

Title always return null in my case.

Can somebody help me please? I don't know what I'm doing bad...

2 Answers
Related