java - Android - End TextWatcher when user enters '.' -


i have textwatcher set , working (nearly) want it. however, textwatcher stop user enters '.'. solution have found far crashes app if user entirely deletes text. important entire textwatcher ends @ moment user enters '.'.

i have tried placing textwatcher within loop, doesn't seem work.

private textwatcher userenterlistener = new textwatcher() {      @override     public void aftertextchanged(editable s) {         // todo auto-generated method stub       }       @override     public void beforetextchanged(charsequence s, int start, int count,             int after) {            if(after==0) {             showntext = "please try again";         }         else if(after==1) {             showntext = "a";         }         else if(after==2) {             showntext = "an";         }         else if(after==3) {             showntext = "and";         }         else if(after==4) {             showntext = "andr";         }         else if(after==5) {             showntext = "andro";         }         else if(after==6) {             showntext = "androi";         }         else if(after==7) {             showntext = "android";         }         else if(after==8) {             showntext = "android a";         }         else if(after==9) {             showntext = "android ap";         }         else if(after==10) {             showntext = "android app";         }         else {             showntext = "please try again";         }         }      @override     public void ontextchanged(charsequence s, int start, int before,             int count) {          recordedstring = (s.tostring());           update();       }     }; 

maybe work:

public void ontextchanged(charsequence s, int start, int before,         int count) {      if(s.tostring().equals("android app") && start == '.'){         //here add empty textwatcher edittext has textwatcher added.  }     recordedstring = (s.tostring());       update();   } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -