luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling #93

Closed shaolim closed 6 years ago

shaolim commented 6 years ago

Hi, i am facing some issue. when i use notifyDataSetChanged() on section adapter, it get fatal exception java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling.

@Override
    public void notifyCheckedChange(boolean isChecked, int position, String header) {
        tagsMap.get(header).get(position).setChecked(isChecked);

        this.runOnUiThread(new Runnable() {
            public void run() {
                sectionAdapter.notifyDataSetChanged();
            }
        });
    }

when i not use notifyDataSetChange() it not crashed, but when i scrolled too fast, some of item in list changed its value.

can you suggest me anything to fix this issue?