How to use FirebaseRecyclerAdapter

前端 未结 1 996
夕颜
夕颜 2021-01-25 14:08
@Override
public void onStart() {
    super.onStart();

    FirebaseRecyclerAdapter firebaseRecyclerAdapter = new FirebaseRecyclerAdapte         


        
相关标签:
1条回答
  • 2021-01-25 14:35

    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

    0 讨论(0)
提交回复
热议问题