Android CheckBox Example

In this tutorial, I am going to show how to use android CheckBox in android application. CheckBox is a two state button that user can select or unselect. Users can check one or more option from a set. Following is the simple steps to show and control CheckBox.

Android Radio Button Example
Android SeekBar Example
Android WebView Tutorial with Example

Android Example: How to use Android CheckBox

Create a new Android Project

Let’s start by creating a new android project with following information to use android CheckBox

Application Name: Android CheckBox Example
Company Domain: viralandroid.com
Package Name: com.viralandroid.androidcheckboxexample
Minimum SDK: Android 2.2 (API 8 Froyo)

XML Layout File

Following is the xml layout file with many CheckBox and added onClick attribute in all CheckBox.

Java Activity File

In java activity file we control the CheckBox select and the code looks like this.

Default content of strings.xml file

Now, run your application which looks like below.


Android CheckBox Example

UI 5007276918768585188
Home item