How to use FirebaseRecyclerAdapter

≯℡__Kan透↙ 提交于 2019-12-02 05:27:50

You need to do the following:

DatabaseReference ref=FirebaseDatabase.getInstance().getReference();
Query query=ref.child("Users").orderByChild("name").equalTo(name);
FirebaseRecyclerOptions<AllUsers> options =
    new FirebaseRecyclerOptions.Builder<AllUsers>()
            .setQuery(query, AllUsers.class)
            .build();

FirebaseRecyclerAdapter adapter = new FirebaseRecyclerAdapter<AllUsers, UsersViewHolder>(options) {

First, you need to configure the adapter by building FirebaseRecyclerOptions

AllUsers is your POJO class, and you need to make a query to have in the recycler adapter.

more info here:

https://github.com/firebase/FirebaseUI-Android/tree/master/database

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