Android can't run simple onTextChange code -


public class mainactivity extends appcompatactivity {     private edittext addresstextbox;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         addresstextbox = (edittext) findviewbyid(r.id.edittext);          addresstextbox.addtextchangedlistener(addresswatcher);     }      private final textwatcher addresswatcher = new textwatcher() {         @override         public void beforetextchanged(charsequence s, int start, int count, int after) {         }          @override         public void ontextchanged(charsequence s, int start, int before, int count) {             addresstextbox.settext("dsa");         }          @override         public void aftertextchanged(editable s) {         }     }; } 

when change text shows application isn't responding wait/close.

  1. why happen , how can fix that?
  2. what s stand in ontextchanged method?

i might wrong this, seems like:

public void ontextchanged(charsequence s, int start, int before, int count) {         addresstextbox.settext("dsa");     } 

would trigger itself. meaning text changed, ran function, changes text, runs function, , on forever.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -