Filter in FirebaseRecyclerViewAdapter

烈酒焚心 提交于 2019-12-12 12:36:02

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/35380887/filter-in-firebaserecyclerviewadapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!