0

I need to sort the data in descending order based on the timestamp and keys(which are autogenerated by firebase).

I tried the answer given in the question. But it throws an error that endAt() takes only one parameter.

How to use startAt(double value, String key) and endAt(double value, String key) Firebase RealTime Database in Android

How should i pass two parameters in the method.

RAHIL MODI
  • 1
  • 1
  • 1
  • Firebase Database queries can only order/filter on a single property. In many cases it is possible to combine the values you want to filter on into a single (synthetic) property. For an example of this and other approaches, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Mar 21 '18 at 23:49
  • The second parameter to `endAt` would not allow you specify a second sort order anyway. It merely allows you to pass in a tie-breaker key at which to stop in case there are multiple items with the same timestmap. – Frank van Puffelen Mar 21 '18 at 23:50

0 Answers0