Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

radio group get selected value android kotlin

fun getSelected() {
	val radioGroup = findViewById<RadioGroup>(R.id.rgColors)
    val color = when(radioGroup.checkedRadioButtonId) {
    	R.id.rbBlue -> "Blue"
        R.id.rbGreen -> "Green"
        R.id.rbRed -> "Red"
        else -> "Other
    }
}
 
PREVIOUS NEXT
Tagged: #radio #group #selected #android #kotlin
ADD COMMENT
Topic
Name
9+7 =