question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Chip] Support ChipGroup.setOnCheckedChangeListener() regardless of single selection mode

See original GitHub issue

Please consider supporting ChipGroup.setOnCheckedChangeListener() without app:singleSelection="true".

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nclaff89commented, Aug 25, 2020

@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.

2reactions
tatsuyafujisakicommented, Jun 19, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found