How to update/refresh specific item in RecyclerView

前端 未结 13 1325
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 18:31

I\'m trying to refresh specific item in RecyclerView.

Story: Whenever user clicks on item, it shows AlertDialog. User can

13条回答
  •  执笔经年
    2020-11-29 18:52

    A way that has worked for me personally, is using the recyclerview's adapter methods to deal with changes in it's items.

    It would go in a way similar to this, create a method in your custom recycler's view somewhat like this:

    public void modifyItem(final int position, final Model model) {
        mainModel.set(position, model);
        notifyItemChanged(position);
    }
    

提交回复
热议问题