If you not understand this lecture Checkbox creation using android studio .You should also read my previous lectures. Checkbox creation using android studio and Button and its click events in android . After reading these lecture you will also able to create Checkbox of your app.


Represents a checkbox user can checked and unchecked  the different items.Checkbox provides option between two elements yes or no . Check box are show in screen as a square box that contain white box.You will used check box as a vertical list.By using check boxes in your form, you can present users with specific options from which to choose and allow them to select.


In this lecture well we describe how can create Checkbox in android.We will also describe Checkbox description.what is Checkbox . why we can use it .After Reading this lecture you will understand Check box in android And i hope you will create Check box of your application.

Description of  Android Checkbox

In this lecture we will describe how to create android checkbox. Benefit of using  android checkbox you can select multiple option at a  same time .One of the easiest way to accept user input in an android.we are going to use a button  when it’s pressed, a message will be displayed  status of the checkbox  that is checked or unchecked.So we create a application that handle checkbox in android.First of all you will create a new project in android studio.  Every project contain two file first is java class file and second is layout XML file your first step is open a layout XML file and change relative layout to linear layout.After change into linear layout you will remove all the padding component in linear layout and set the height and width match parent of linear layout. Match parent means height and width similar to the parent.First we create a GUI of application and add a text view and set height and width.Now we add three check box and set height and width and assign id to each check box. User can checked and unchecked each item. Now we can also apply on click in each item and add button when user click on button show message which item user is select. for more detail about checkbox creation using android click on checkbox creation using android .So you will find out the value folder expand this value folder and click on string XML file and add string resource  in string .XML file.Now i open a string. XML file and paste that code of checkbox creation using android

XML Layout 

First of you will open a XML file of layout and set Linear Layout  and add  Edit text  .After that we will also add three check box and set height and width and also assign unique id to each check box.. At the end of these check box we also used button. Purpose of use button is that when user check and unchecked option and click on button then message will show on activity  which option user is selected.

Different property that are used in layout.xml file  explain here

  • warp_content   warp_content means height and width similar to the text that are entered.
  • Match_parent   means height and width similar to parent.
  • Check box       Check box provides option between two elements yes or no.
  • Button              when button can be pressed, or clicked, by the user to perform an action

In this example we are going to create a simple UI that includes only (checkbox) with Different attributes.And paste the following code checkbox creation using android into layout .XML file.

Now you may open the Graphical layout editor to preview the User Interface you created of checkbox creation using android .

Alt Tag checkbox in android

Main Activity

In main activity we will use a  switch case in which get id of each check box.It can divide into two alternative if and else  condition when user can checked a option then if condition will invoke.when user can not checked a option then else condition will invoke.three cases we will use and every case will divide  into two alternative if and else.

Code that are placed in java class file of checkbox creation using android .

Run the application of checkbox creation using android

Alt Tag checkbox in android
Now when you can checked first two option then output show in below pic

Alt tag checkbox output

Now when you can checked all  option then output show in below pic

Alt tag checkbox output2

“Thank you”  for reading this lecture, Hope you got the idea.