java - Fast tapping on soft keyboard -
i'm using textwatcher prevent users insert double spaces. following part of code.
@override public void aftertextchanged(editable s) { final string = s.tostring(); final string b = s.tostring().replace(" ", " "); if (a.length()>b.length()){ int pos = name.getselectionstart(); name.settext(b); name.setselection(pos-1); }}
the code works fine if 1 simple taps slowly. anyway, problems arise when tap quite fast, begins deleting characters before first space.
do have idea why happen , how solve it?
Comments
Post a Comment