0

Before I start explaining I'll just get you into the code.

EditText br = (EditText) findViewById(R.id.editText);

if ( br.getText().toString() == "0") {
    Toast.makeText(MainActivity.this, "It works", Toast.LENGTH_LONG).show();
}

It's that simple. But I don't understand why it doesn't work! I typed in ("1" == "1") in the if statements just to see if there is anything else wrong. But the message shows up on my phone.

The edittext field has the number 0 on it. I have no clue why this simple if statement would not work.

melpomene
  • 84,125
  • 8
  • 85
  • 148
Vraces
  • 21
  • 6

0 Answers0