I'm having a problem when I type any text in the "Text Box" It only returns one of the IF value's no matter what.
my code:
public void b (View view) {
//Defined Methods
EditText r = (EditText) findViewById(R.id.Rab);
TextView a = (TextView) findViewById(R.id.Rabby2);
String name = r.getText().toString();
//The Code
if (!name.isEmpty()) {
a.setText("");
}
if (!name.equals("Rab")) {
a.setText("Hey Rab Long Time No See");
}
else {
a.setText("Hello " + name + " nice to meet you I'm Rab");
}
}
If I type any text it returns "Hey Rab Long Time No See" I only want it to return that if the string is "Rab" Thank you :)
Aucun commentaire:
Enregistrer un commentaire