How To Use Android Checkbox In Android App

In Android Checkbox Is Simply Use For the Selection. When We Want To Choose More Than One Item Then We Have To Use This Control.




  • We can create this  instance by declaring it inside a layout(XML file) or by instantiating it programmatically(Java Class).


 code in JAVA:

Step 1: Create a new project and name it What You Want TO Give.

  • Select File -> New -> New Project. Fill the forms and click “Finish” button.

Step 2: Open res -> layout -> xml (or) activity_main.xml and add following code. Here we will create a CheckBox in Relative Layout

Step 3: Open app -> java -> package and open and add the following code. Here we will display in toast which is checked.

Output :

Now run the app in Emulator and click on the button. You will see which checkbox is checked and display it name in toast.


Leave a Reply

Your email address will not be published. Required fields are marked *