How to remove items from firebase RecyclerView

后端 未结 3 630
你的背包
你的背包 2020-12-10 07:42

I\'m currently working on Adding Friends with the help of firebase RecyclerView in which if a user tap on ADD button, he is added in database n that tapped item is needed to

3条回答
  •  孤街浪徒
    2020-12-10 08:29

    The FirebaseUI FirebaseRecyclerAdapter is a direct representation of the data in the underlying Query or Firebase location. To remove an item from the adapter (and view), you have to remove it from the Firebase location (or ensure it doesn't match the query anymore).

    So when the user triggers the deletion (e.g. by clicking on an item at a certain position):

    adapter.getRef(position).remove()
    

    Also see this issue in the FirebaseUI Github repo.

提交回复
热议问题