Jas1997 Jas1997 - 10 months ago 75
Java Question

Sorting firebase objects based on long values on android

I am currently working on an android app that shows times/dates for rides to and from certain locations. I want to sort my firebase objects so that objects are sorted based on date. I tried searching online and playing with the methods

, and
, but I cannot find a clear way on doing this.

This is what my database looks like currently

This is what my database looks like currently

I have the date in a
data type, and I want my firebase recycler view to show the rides in ascending order, in terms of how soon the ride is from the current date. Thanks!

Answer Source

You can query like this:

Query query = mRideRef.orderByChild("date");

And then set a listener to get the values