Generally when there is form or any any other kind where we have to choose multiple options then we use check-box.Several application use it to create a checklist,  enabling or disabling services, selecting products, contacts , messages and many more much easier than selection individually.

If you want to select one out of two or more but only a single option(one button radio) then radio-button is the best one for it can refer below link

 

custom radio button android / android radio button example 

http://www.androidcoding.in/radio-button/

now i hope you understand difference between android radiobutton and checkbox

A Check-box in android can also be customized  i.e., design can be changed accordingly color of check box and backgrounds can be changed on user click.

 

In this android checkbox example i will show how to make a check on a check-box to select values from present three values user can select any value or all the available values and on clicking submit button selected value is toasted one by one.

MainActivity.java

Using a if condition we are assigning functionality on each checkbox selection,

on submit button click you can see the toast appearing for the selected values.

 

 

Add check boxes in layout file design can be made based on number of check boxes.

 

activity_main.xml

AndroidManifest.xml

Output :

 

checkbox1

 

checkbox2

 

If you have any query regarding tutorial let me know below in comment section.

Like and share for more android tutorials.

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on Alert-box

Close