checkedRadioButtonID integer to string in output Kotlin

I have a basic survey app that emails results upon hitting the submit button at the end. In the string that is built it calls the result of the checked radio button to put into the email, but it’s showing as an integer instead of the button text.


val id = group1.checkedRadioButtonId

returns 213120809 or 2131230810 depending on which response is checked

I’ve tried to add getString() to it so like so:

val id = group1.checkedRadioButtonId.getString()

but that doesn’t seem to do anything. Does anyone know if there’s another command I should be using? This is in Kotlin.


There is no property to get selected button text.

You can get it like this

val radioButtonText = when (group1.checkedRadioButtonId) {
                -> radioButton1.text
                         else -> radioButton2.text