Android setOnCheckedChangeListener calls again when old view comes back

前端 未结 8 1964
鱼传尺愫
鱼传尺愫 2020-12-14 06:39

I cannot solve an issue with the getGroupView-method.

the problem is that the listener setOnCheckedChangeListener is getting invoked to many times.

Let say

8条回答
  •  鱼传尺愫
    2020-12-14 07:13

    I faced the same problem and struggled for several hours seeing all discussions related to this. I tried to fix this by keeping viewHolder.checkBox.setTag(groupPosition);
    this statement before viewHolder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() this listener. And the code works exactly as expected.

提交回复
热议问题