android - how to used Textwatcher for change of background color of EditText array when we want to guess word of the EditText correctly -


how use textwatcher change of background color of edittext array when want guess word of edittext correctly?

example:

public edittext[] edts=new edittext[9]; string[] etd={"f","m","v","f","m","v","f","m","v"}; 

just add ontextchangedlistener of edittexts:

    public edittext[] edts=new edittext[9];     string[] etd={"f","m","v","f","m","v","f","m","v"};     private void addtextchangedlisteners() {         (int = 0; < edts.length; i++) {             final int idx = i; //necessary inner class             edts[i].addtextchangedlistener(new textwatcher() {                 @override                 public void beforetextchanged(charsequence s, int start, int count, int after) {                     //no implementation needed.                 }                  @override                 public void ontextchanged(charsequence s, int start, int before, int count) {                     if (s.tostring().equals(etd[idx])) {                         edts[idx].setbackgroundcolor(color.parsecolor("#ff00ff"));                     }                 }                  @override                 public void aftertextchanged(editable s) {                     //no implementation needed.                 }             });         }     } 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -