Introduction
This blog explains how to develop a checkbox app in an Android Application, using Android Studio.
Requirements
- Android Studio 2.1.3
If you want create a checkbox app, it should follow the steps given below.
Step 1
Now, open Android Studio and you can choose the File, followed by New. Afterwards, choose New Project.

Step 2
Here, you can create Your Application name and choose where your project is stored on the location and click Next button.

Now, we can select the version of Android. It is Target Android Devices.

Step 3
Here, we can add the activity, more activity is available, and click Next button.

Now, we can write the activity name and click the Finish button.

Step 4
Now, open your project and you will go to the activity_main.xml and afterwards, you will build the design. It should choose toolbox and if you want some other option (CheckBox, TextView), use the drag and drop method.

Now, we can see the Graphical User Interface design.

Step 5
Now, you will go to the resource folder and select the String.xml. Subsequently, you need to add the string value.

srings.xml code
- <resources>
- <string name="app_name">CheckBoxApp</string>
- <string name="Apple">APPLE</string>
- <string name="Banana">BANANA</string>
- <string name="BluBerry">BLUEBERRY</string>
- <string name="Grapes">GRAPES</string>
- <string name="Straw">STRAW</string>
- </resources>
Here, you need to build on design and write the .XML code.
activity_main.xml code.
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="xyz.rvconstructions.www.checkboxapp.MainActivity">
- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Select Your favorite fruits: " android:textColor="#f00" android:textSize="20sp" android:textStyle="bold" />
- <LinearLayout android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:background="#e0e0e0" android:orientation="vertical">
- <CheckBox android:id="@+id/applechkb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:checked="false" android:padding="20dp" android:text="@string/Apple" android:textColor="#44f" android:textSize="20sp" android:textStyle="bold|italic" />
- <CheckBox android:id="@+id/bananachkb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:checked="false" android:padding="20dp" android:text="@string/Banana" android:textColor="#f44" android:textSize="20sp" android:textStyle="bold|italic" />
- <CheckBox android:id="@+id/strawchkb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:checked="false" android:padding="20dp" android:text="@string/BluBerry" android:textColor="#444" android:textSize="20sp" android:textStyle="bold|italic" />
- <CheckBox android:id="@+id/blueberrychkb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:checked="false" android:padding="20dp" android:text="@string/Grapes" android:textColor="#888" android:textSize="20sp" android:textStyle="bold|italic" />
- <CheckBox android:id="@+id/grapschkb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:checked="false" android:padding="20dp" android:text="@string/Straw" android:textColor="#101010" android:textSize="20sp" android:textStyle="bold|italic" />
- </LinearLayout>
- </RelativeLayout>







Join the conversation! Your thoughts help the community grow.