Checkbox in Android


Checkbox is a two-states button that can be either checked or unchecked. When the radio button is unchecked, the user can click it to check it or vice-versa. Unlike RadioButton, android check box works like toggle between two states.

Android CheckBox Example
Let us create a example that displays three checkbox and responds to user click event. When user selects or un-select the button, it displays a toast with its state. Create a new layout file named activity_main.xml under layout resource folder and add the following code snippets. The code will generate the layout as shown in the screenshot below.

In the above layout class, we are using below strings


You may also like...

Leave a Reply