java - how to invoke a new activity the moment the user enter exactly 4 digits of code into an editText box -
i invoke new activity moment user enter 4 digits of code edittext box.
how can catch exact moment user enter 4 , last digit , invoke action checks if code valid.
thanks,
gil.
use text watcher
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 //start activity if (s.length()==4) startactivity(new intent(callingactivity.this,calledactivity.class)); } });
Comments
Post a Comment