Issue
I am new to phone app dev, so Android Kotlin dev is totally new to me. I am in a training session provided by the official android site.
The line below uses binding to access a selected radio button in a radio group.
val selectedId = binding.tipOptions.checkedRadioButtonId
I couldn't find checkedRadioButtonId attribute in my XML file. Instead, my XML file and the android docs has only android:checkedButton. Anyone know where checkedRadioButtonId is from? Thanks.
Solution
binding.tipOptions is a RadioGroup in your xml layout file. the RadioGroup.java has a function named getCheckedRadioButtonId(). On kotlin it can be used like checkedRadioButtonId, because kotlin getter and setter syntax: getters-and-setters
Answered By - ruby6221
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.