Zuhayr
Zuhayr

Reputation: 352

Do not remove items from Firebase recycler adapter?

Is it possible to have Firebase's recycler adapter not remove items from its model, and only add them? Or do I have to use the listview adapter to achieve this?

I'm using it for a messaging application whose database references change over time, but I'd like the client-side messages not to disappear when the recycler adapter's database reference changes.

Upvotes: 0

Views: 550

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598728

If you're using the FirebaseRecyclerAdapter from FirebaseUI, then it will always show a direct reflection of the underlying collection/query. There is built-in way to make it show data that is no longer in the database.

Luckily FirebaseUI is open-source. So you could take the adapter (and its underlying FirebaseArray class, which is the real workhorse) and modify it for your needs.

Upvotes: 1

Related Questions