I am trying to compare the text of a button to decide on the course of action to take in this Android app I am making. I am getting some unexpected behavior that I do not understand.
clickMeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (v.getId() == R.id.btnLeft) {
Button button = (Button) v;
String click = new String("Click me");
String look = new String(button.getText().toString());
Boolean check = new Boolean(look == click);
if (button.getText().toString() == "Click me") {
Variable check is returning false. Why? In debugger, both items have "Click me" listed next to them. The button I click in the emulator says "Click me" and its original text, "Click me" is specified by the xml.