Creating Checkboxes in an Android application using Eclipse
In this tutorial, you will be Learning, How to display Checkboxes (editable) in an activity?
Here you go!!!!
Before creating an android application using Eclipse, let us see some of the key terms involved while developing this application.
Key terms involved in this project:
Checkbox: Checkboxes allow the user to select one or more options from a set. Typically, you should present each checkbox option in a vertical list. When the user selects a checkbox, the CheckBox object receives an on-click event. To define the click event handler for a checkbox, add the android:onClick attribute to the <CheckBox> element in your XML layout. The value for this attribute must be the name of the method you want to call in response to a click event. The Activity hosting the layout must then implement the corresponding method.
** UPDATE: Android Complete tutorial now available here.
Bundle: Bundle is generally used for passing data between various Activities of android. It depends on you what type of values you want to pass but bundle can hold all types of values and pass to the new activity. Bundles can be used to send arbitrary data from one activity to another by way of Intents. When you broadcast an Intent, interested Activities (and other BroadcastRecievers) will be notified of this. An intent can contain a Bundle so that you can send extra data along with the Intent.
Bundles are key-value mappings, so in a way they are like a Hash, but they are not strictly limited to a single String / Foo object mapping. Note that only certain data types are considered “Parcelable” and they are explicitly spelled out in the Bundle API.
The tutorial is about how to display checkbox in the UI of the android application.
This project is developed in Eclipse 4.2 (Juno) and tested with Android 2.2
<?xml version="1.0" encoding="utf-8"?>
<! -- Application Name -->
<!--Question to be displayed on the screen -->
<string name="question">Choose more than one which is true about Sachin Tendulkar</string>
<!-- specify properties such as height, padding, font color, font size, background color -->
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
<style name="AppBaseTheme" parent="android:Theme.Light">
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
Run the android application:
Android applications can be run on the android devices. You can either connect a hardware to the system to test the application or you can use the android virtual devices (AVD) Manager to create/manage the virtual devices running on emulator to run the application.