android: How to replace a word with another text in edittext using addTextChangedListener? -


i have edittext. want when use type sentence. after space words changed another. want perform using addtextchangedlistener only. i'm using following code:

edittext.addtextchangedlistener(new textwatcher() {              @override             public void ontextchanged(charsequence s, int start, int before,                     int count) {                  // todo auto-generated method stub                  }              @override             public void beforetextchanged(charsequence s, int start, int count,                     int after) {                 // todo auto-generated method stub             }              @override             public void aftertextchanged(editable s) {                 // todo auto-generated method stub             }         }); 

edittext.addtextchangedlistener(new textwatcher() {              @override             public void ontextchanged(charsequence s, int start, int before, int count) {             }               @override             public void aftertextchanged(editable str) {                 editable ab = new spannablestringbuilder(str.tostring().replace("a", "a"));                 edittext.settext(ab);             }               @override             public void beforetextchanged(charsequence s, int start, int count,                                           int after) {             }          }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -