Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill RecyclerView Adapter with Firebase

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?

like image 482
Adem İlhan Avatar asked Jun 29 '15 07:06

Adem İlhan


2 Answers

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.

like image 167
Frank van Puffelen Avatar answered Sep 17 '22 15:09

Frank van Puffelen


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

like image 25
Hon Avatar answered Sep 19 '22 15:09

Hon