Order Firebase RecyclerView by Child Value
See original GitHub issueI have a data structure (see below) and I essentially want to create a “trending” section that emphasizes the items that have the most votes. Votes are accounted for in the vote_count field of my Firebase database.
I know there is the .orderByChild() method available in Firebase. Would it be possible to have my RecyclerView sort the data based on the value of the vote_count child (descending order)?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Ordering Firebase Data in Arraylists/RecyclerView
Since you are using firebase datastore. You can sort the values by these 3 methods in it. orderByChild() orderByKey() orderByValue().
Read more >Work with Lists of Data on Android - Firebase - Google
You can use the Realtime Database Query class to retrieve data sorted by key, by value, or by value of a child. You...
Read more >Android Firebase 05 : RecyclerView – Sorting Data - YouTube
In this part we will apply sorting with sorting options "Newest" & "Oldest" to Firebase data displayed in RecyclerView.
Read more >retrieve data from firebase to recyclerview - YouTube
This document covers the basics of retrieving data and how to order and filter Firebase data.In this video I will show you how...
Read more >How to populate RecyclerView with Firebase data using ...
All data values are stored in a string format for ease. ... your app/build.gradle file in order to get the FirebaseUI and Firebase...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jesusignazio setReverseLayout with your layout manager and then setstackfromend will do the descending order
@troy21688 No, that’s good. Since you can pass in a query, just use
orderByChild("vote_count")
for the query/ref you pass into your adapter.