lundi 20 février 2017

Java/xml checkbox

I'm currently playing around with android studio and making my first (simple, testing) app. I've created a checkbox in XML with an id. If I check the box and hit "submit" it show's a summary of all the check boxes in the bottom. Well, at least I want it to.

I have a displayMessage method that display text in a specific view by id which works fine. However, I've created a method that checks if the check box is checked, and if it is, it's uses the displayMessage method to output a message. I'm not getting any output.

private void testingCheckBox(){
CheckBox whippedCreamBox = (CheckBox)  findViewById(R.id.whipped_cream_check);
if(whippedCreamBox.isChecked()){
displayMessage("\nWhipped Cream Added");
            }
        } 




Aucun commentaire:

Enregistrer un commentaire