lundi 9 octobre 2017

Checkbox showing same results regardless of whether it is checked

I have a problem using checkbox in Java. Regardless of whether the checkbox is checked, the result is always Yes. Can somebody help me check if there is any error with the code below please?

private String whippedCreamMethod(){
CheckBox checkBoxWhippedCream = (CheckBox) findViewById(R.id.whipped_cream_checkbox);
   if (checkBoxWhippedCream.isSelected()){
       whippedCream = "No";
   } else {
       whippedCream = "Yes";
   }
    return whippedCream;

}




Aucun commentaire:

Enregistrer un commentaire