app ordering development, android firebase

Asked

Viewed 190 times

0

good evening guys wanted to ask a question, I’m developing an app, and use firebase but I’m kind of layman still in programming, in order wanted to know if there is any way to sort the data that comes from firebase in recyclerview in the form of cards, If anyone could give me an example, I’d appreciate it. thank you very much...

  • friends has already been solved my problem, someone understood the question!

1 answer

1


You can use orderByChild. Example:

DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();   
Query peopleTypeQuery = mDatabase.child("people").orderByChild("age");

peopleTypeQuery.addChildEventListener(new ChildEventListener() {

    @Override public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) {

    }
});

it will sort by the key value "age"

  • thanks I will put in my code, after sorting if I want to put in certain fields example category and compare with key if key is equal such category returns such, you could help me in this logic, already thank you

  • ai has to create the conditions(if), opens another question with snippets where you want help there I can help better.

  • okay Edson.....

Browser other questions tagged

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