mercredi 23 septembre 2015

A simple if statement not working

I've been trying to figure out what's wrong with this if statement and it's making me feel really dumb. My problem is that it will display a toast saying SUCCESS and then also a toast saying FAILURE. Why is it displaying both?

if (value.contains("CARR")) {
     tvCarrierValue.setText(value);
     Toast.makeText(getApplicationContext(), "SUCCESS", Toast.LENGTH_SHORT)
     .show();
} else {
     Toast.makeText(getApplicationContext(), "FAILURE", Toast.LENGTH_LONG)
     .show();
}

Aucun commentaire:

Enregistrer un commentaire