app development ordering, firebase android [closed]

0

Good night guys I wanted to take a doubt, I'm developing an app, and I use firebase but I'm still a layman in programming, so I wanted to know if there's any way to sort the data that comes from firebase in recyclerview in the form of cards, if someone can give me an example, thank you. Many thanks ...

    
asked by anonymous 29.09.2017 / 02:49

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"

    
29.09.2017 / 03:18