Android Studio – Android Checkbox Example




In this tutorial we will learn How to use Checkbox in Android Using Android Studio.

Generally we use checkboxes when we want to choose from a list of items. For Example we want to give the option to the user to select his/her favorite animal, in this case we can use chackboxs to give those options.

So lets create a project.

Step 1  – Create new Android project

Step 2 – Add three CheckBox in the main activity. Also Add a button to the main activity as shown in the picture below.

Android Checkbox Activity Design
Android Checkbox Activity Design

Step 3 – Give Android id to checkboxs and button as shown in the activity_main.xml file.

layout/activity_main.xml

 

Step 4 – Finally write the following code in MainActivity.java file

 

com/example/programmingknowledge/thefirstapp/MainActivity.java

 

OUTPUT:

Android Tutorial for Beginners - Android Checkbox Basics With Example
Android Tutorial for Beginners – Android Checkbox Basics With Example

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com