How to fill RecyclerView Adapter with Firebase

2019-01-14 07:18发布

I made a lot of research, but I couldn't find any resource how to use Recycler View with Firebase(or vice versa)

There is one Firebase list adapter which extends from BaseAdapter. I found it in Firebase Chat application. Here is the FirebaseListAdapter class. But the adapter which is used by RecyclerView needs to be extended from RecyclerView.Adapter.

How did you overcome this problem? Do you have any suggestion?

2条回答
姐就是有狂的资本
2楼-- · 2019-01-14 07:41

you can use the FirebaseUI-Android, it is developed by Firebase itself which is quite useful.

The link shown as below.

https://github.com/firebase/FirebaseUI-Android/blob/master/database/README.md

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-01-14 07:59

For the moment you will have to provide your own implementation of the RecyclerView.Adapter.

You can use the FirebaseListAdapter for inspiration or roll your own.

Here's a chat app that uses a RecyclerView: https://github.com/thaleslima/Chat-Firebase/tree/master/app/src/main/java/com/gdgcampinas/chat_firebase

Update

There is now a library called FirebaseUI that includes a FirebaseRecyclerAdapter and much more. I highly recommend that you use that one in your apps or as the basis for an adapter that suits your needs.

查看更多
登录 后发表回答