[Chip] Support ChipGroup.setOnCheckedChangeListener() regardless of single selection mode
See original GitHub issuePlease consider supporting ChipGroup.setOnCheckedChangeListener() without app:singleSelection="true".
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Chip Group OnCheckedChangeListener() not triggered
Your code is fine the only issue is that setOnCheckedChangeListener() only work when your ChipGroup is for singleSelection.
Read more >ChipGroup - Android Developers
When in single selection mode , returns the identifier of the selected chip in this group. List<Integer>, getCheckedChipIds(). Returns the ...
Read more >Minute of Pain #5: ChipGroup functionality | by Michael Spitsin
So the chip group has a pretty convenient method setOnCheckedChangeListener . But it only works for single choice mode.
Read more >Android P: Chips and ChipGroup - DigitalOcean
setOnCheckedChangeListener on the ChipGroup only gets triggered when the ChipGroup is set to a single selection. The output of the above ...
Read more >Chips – Material Design 3
Chips help people enter information, make selections, filter content, or trigger actions. Chips can show multiple interactive elements together in the same ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@gabrielemariotti thanks for the quick reply. I ended up just making a custom chip and overriding performClick(). I need to be able to react to the state of each individual chip, while multiple are selected. the chips are created at run time, not in the lay out and i need to be able to have singleSelection = false. When a user checks a chip I need to update my UI to display a banner based off if the chips are selected and if a boolean corresponding to one of the chips is true.
EDIT: @gabrielemariotti I ended up playing with it more, and what you suggested worked. I must have been missing something earlier. Thanks again for your speedy response. It is much appreciated.
@wcshi I use multiple ChoiceGroup(s).
For some ChoiceGroup, I use single-selection chips and add an OnCheckedChangeListener on the ChoiceGroup. For other ChoiceGroup, I use multiple-selection chips and add an OnClickListener (or an OnCheckedChangeListener) on each chip.
It is OK, but it would be great if I could implement listeners in the same way among different ChoiceGroup(s) for maintainability.