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.
- why happen , how can fix that?
- what
s
stand inontextchanged
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
Post a Comment