samedi 22 octobre 2016

how can i make 2 strings with the same name say something differnt using an if statment

ok so i have a few check boxes in an activity and when i check them i want it to trigger a string which then gets sent via email. but if they not checked i want it to trigger a different string to send. i thought some thing like this would do it but it only triggers when the check box is checked.

  Override
public void onCheckedChanged(CompoundButton buttonView, boolean b) {
    switch(buttonView.getId()){

        case R.id.cbLights:
    if (cbLights.isChecked())
        HeadlightString = "lights satisfactory";
    else if (!cbLights.isChecked()){
        HeadlightString = "lights not satisfactory";
    }




Aucun commentaire:

Enregistrer un commentaire