Jaume Colom Ferrer
Jaume Colom Ferrer

Reputation: 334

How to put an Edittext with a button below that when I click, it recognizes if it's correct or wrong?

My intention is to put an Edittext, and a Button below, and when the user put an specific word and click the button, the value is correct, and all the other different words are wrong.. How to identify it with codes?

Upvotes: 0

Views: 55

Answers (1)

Prachi
Prachi

Reputation: 3672

  btn.onClickListiner(this);

  @Override
   public void onClick(View v) {
      if (v == btn) {
   // check word
     String word = editText.getText().toString(); // don't forget "toString()" .
    // checking word below :

  }}

Upvotes: 0

Related Questions