3

On that question ( how to implement a SetOnItemClickListener FirebaseRecyclerViewAdapter ) I learned how to use the FirebaseRecyclerViewAdapter to get the click of recycler view, perfect.

Now I need to filter RecyclerView items made with the FirebaseRecyclerViewAdapter. In my business rule listo of the items and the user can filter them.

If it was manual, a list adding the adapter I know, but as the FirebaseRecyclerViewAdapter is responsible to prepare / update the list, someone has a suggestion how to put a filter?

Community
  • 1
  • 1
Jonas Rotilli
  • 176
  • 1
  • 3
  • 12

1 Answers1

4

Client-side filtering is not supported in the current version of FirebaseUI. It's on the roadmap, but not planned yet: https://github.com/firebase/FirebaseUI-Android/issues/15.

In the meantime, you can either use Firebase's built-in Query capabilities to limit the data. This has the advantage that only data matching the conditions will be downloaded from the server.

A great example of how advanced you can make this, is the "friend search" feature in the ShoppingList++ app of the Udacity course Firebase Essentials for Android. You can find the crucial class here in Github, but I highly recommend taking the entire course to see how this works.

jjacobson
  • 392
  • 1
  • 4
  • 14
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Hi @Frank, Im using this example from ShoppingList++ to filter in a SearchView inside a toolbar on my current app. But I have a question: is not so expensive make multipla calls to the client-side in this kind of short time? Is there any way to make it less expensive? using keepSync(true) or any other cache Firebase feature? Thanks for your time! – Francisco Durdin Garcia Sep 27 '16 at 07:06