How to get the selected chips from a Chip Group in Kotlin.

  1. Update your Material Gradle dependency version
implementation ''

2. You get this method: checkedChipIds

tagGroup.checkedChipIds.forEach {
Log.d("TEST", " chip ids ---> " + it)

If you are using old material version you don’t have the method: checkedChipIds, and have to create the method. To create local method to return checked chips:

fun ChipGroup.getCheckedChipIds(): List<Int>? {
val checkedIds: ArrayList<Int> = ArrayList()
for (i in 0 until childCount) {
val child: View = getChildAt(i)
if (child is Chip) {
} else {
return checkedIds

Thanks for reading

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store