Sort data Firebase

Asked

Viewed 115 times

0

I am trying to sort my search by date, however I have to look for a value and it is not allowed to use two orderByChild. I need to either find the name passed by the search variable name or sort by the date of birth. Could someone help?

referenciaFirebase.child("cliente").orderByChild("nome").equalTo(buscaNome).addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {

                for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
                    final String nomeCliente = postSnapshot.child("nome").getValue(String.class);

                    final String data_nascimento = postSnapshot.child("data").getValue(String.class);

                }


            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
  • Did you try using the Query class ? If not, try using it instead of referenceFirebase

  • Yes, but it was the same

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.