CheckBox | Android Studio | Kotlin
CheckBox | Android Studio | Kotlin CheckBoxes are used to select one or more options from the available options. For example , you have a list of colors and the user can choose one or more colors from that list. We can use the CheckBox widget of android in such scenarios. >>Watch For Java Step 1: Create a new project or open an existing project Step 2: Code Check If CheckBox is checked or not if (androidCb.isChecked) { //check box is checked } else { //check box is not checked or unchecked } Add CheckedChange Listener on a CheckBox androidCb.setOnCheckedChangeListener { _, isChecked -> //check if checkbox is checked or not if (isChecked) { //checkbox is checked } else { //checkbox is not checked } } Complete Example activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi...