android-basics-kotlin-tip-calculator-app-solution | Tip Calculator app contains various UI elements | Apps library
kandi X-RAY | android-basics-kotlin-tip-calculator-app-solution Summary
kandi X-RAY | android-basics-kotlin-tip-calculator-app-solution Summary
Tip Calculator - Solution Code.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of android-basics-kotlin-tip-calculator-app-solution
android-basics-kotlin-tip-calculator-app-solution Key Features
android-basics-kotlin-tip-calculator-app-solution Examples and Code Snippets
Community Discussions
Trending Discussions on android-basics-kotlin-tip-calculator-app-solution
QUESTION
I'm a beginner doing Android Kotlin training.
I want to make the button redundant by adding listeners to all the inputs. The solution MainActivity.kt already has a listener for the text input "cost_of_service_edit_text":
binding.costOfServiceEditText.setOnKeyListener
.
How do you add a radio group listener with ActivityMainBinding
?
The solution layout names the radio group "tip_options".
I tried adding
binding.tipOptions.setOnClickListener{ _ -> handleEvent() }
which didn't crash but also didn't run the handleEvent()
function, when I changed the selection in the radio group.
ANSWER
Answered 2021-Feb-24 at 10:46You have to capture each RadioButton
action event in the RadioGroup. In the sample app, they are capturing the event on CalculateButton
first. Then in the CaptureButton
handler method, they are checking which RadioButton
was clicked here:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install android-basics-kotlin-tip-calculator-app-solution
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page