Friday, December 7, 2018

Android Check-Box Tutorial

Android Check-Box Tutorial


CheckBox is used to implement multiple choices. There can be a lot of usage of checkboxes. For example, it can be used to know the hobby of the user, activate/deactivate the specific action etc..

Mainly for checkbox there are two methods

1. isChecked() - Returns true if it checked otherwise false.
2. setChecked(boolean status) - change the status of checkbox.

see the below piece of code:


if(pizza.isChecked()){
    result.append("\nPizza 100Rs");
    totalamount+=100;
}
if(coffe.isChecked()){
    result.append("\nCoffee 50Rs");
    totalamount+=50;
}
if(tea.isChecked()){
    result.append("\nTea 10Rs");
    totalamount+=10;
}

To watch tutorial video please click on below video link-











No comments:

Post a Comment