Monday, 19 June 2017

Working with CheckBox in Android

Working-with-CheckBox-in-Android

As we have already learned the basics about Button now we discuss about the CheckBox in Android

Read Working with Buttons in Android

Working With CheckBox is similar to that of Button.

Create a new Project and drag and drop a Checkbox

Working-with-CheckBox-in-Android


Then open MainActivity.java and register the checkbox

Checkbox-register-code

Then after that type the following code

Working-with-CheckBox-in-Android-source-code


isChecked   is a Boolean variable which gives two results on clicking the checkbox it gives true and when it is unchecked it gives false.

The Output will be

Working-with-CheckBox-in-Android-output

Working-with-CheckBox-in-Android-output

Working-with-CheckBox-in-Android-output


Read How to Develop a BMI calculator App.