lundi 26 février 2018

nested if else in android studio not working

I am working with chatbot in android studio the problem is when I enter start output go straight with else of choose again ? why so?

if (sendText.equals("Start")) {
 receivedMessage.setText("Are you human?\n\n1 Yes \n\n2 No");
    if (sendText.equals("1")) {
        receivedMessage.setText("proceed");
                } else if (sendText.equals("2")) {
                    receivedMessage.setText("robot");
                } else {
                    receivedMessage.setText("Choose Again");
                }
 }
else {
   receivedMessage.setText("Please Retype Start to Start!!");
     }

Aucun commentaire:

Enregistrer un commentaire