java - Count characters with TextWatcher fails on HTC longpress -
i have 3 edittext elements, , want jump 1 field next if there 4 characters in input.
i use textwatcher this:
geteditview(r.id.edit_code1).addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) {} @override public void beforetextchanged(charsequence s, int start, int count, int after) {} @override public void aftertextchanged(editable input) { if(input.length() == 4){ geteditview(r.id.edit_code2).requestfocus(); } } });
the inputtype edittext "textcapcharacters"
when doing longpress on key number, holding r 4, devices not add letter, until user stops holding button, , fire aftertextchanged after letter 4 selected. on htc keyboard (in case htc desire on 2.3.5) not case. though user still holding button, r added edittext , aftertextchanged fired, , code job , puts focus on next field.
how can undesired behavior prevented? watching onkeydown/up won't help, because doesn't register normal keystrokes.
unfortunately it's bug in htc keyboard no way of fixing it. being event in ime, impossible intercept touch or key events, better off making user skip next input instead of doing them.
if it's important though, can implement own kind of keyboard there, keys need.
Comments
Post a Comment