FirebaseArray in FirebaseListAdapter is not accessible from subclasses
See original GitHub issueSituation
You have a mobile app with Firebase as backend you would like to view all the items in firebase location as cards in UI you would like to remove some items just from the UI (imagine a UI like Tinder app where a user can remove a card from UI and see the other cards in the list, where cards are items in Firebase db but they are not deleted when removed from UI)
Problem with FirebaseListAdapter
I use the FirebaseListAdapter as explained in the tutorial and I can easily retrieve the items from firebase and display them in the UI. I don’t know how to remove items from UI without removing it from Firebase too. The code below remove items from the Adapter but also from firebase.
Firebase itemRef = adapter.getRef(position);
itemRef.removeValue();
I think the only way to remove items from the adpater without removing the firebase reference is to have access to the FirebaseArray used in the FirebaseListAdapter.
Proposed solution ? Have the FirebaseArray protected so that when implementing our CustomAdapter we can have access to the FirebaseArray and remove items from it.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top GitHub Comments
@pantos27
FirebaseRecyclerAdapter
already exposes the methods you likely want:@puf you’re right. @samtstern 's solution should do the work very
Thank you both!