Orderbychild() If Same Value, How To Order By Second Variable?
I work with a list sorted by age. When there are same age, I want it to be sorted by name alphabetically. In this case, Adam should be above and Ramsay should be below. I don't kn
Solution 1:
When using just .orderBy("atribute") you can chain multiple ones to order the results inside the last order. For example: .orderBy("age").orderBy("name")
valdatabase= FirebaseDatabase.getInstance().getReference("Classmate").child("student").orderByChild("age").orderBy("name")
I haven't used it with orderByChild() but i guess it would work the same way.
Post a Comment for "Orderbychild() If Same Value, How To Order By Second Variable?"