Android RecyclerView : notifyDataSetChanged() IllegalStateException

前端 未结 22 1786
天涯浪人
天涯浪人 2020-11-28 02:57

I\'m trying to update the items of a recycleview using notifyDataSetChanged().

This is my onBindViewHolder() method in the recycleview adapter.

@Over         


        
22条回答
  •  抹茶落季
    2020-11-28 03:42

    your CheckBox item is in changing drawable when you call notifyDataSetChanged(); so this exception would be occurred. Try call notifyDataSetChanged(); in post of your view. For Example:

    buttonView.post(new Runnable() {
                        @Override
                        public void run() {
                            notifyDataSetChanged();
                        }
                    });
    

提交回复
热议问题