android - onTextChanged - value of before and count -


i using textwatcher edittext. in ontextchanged method happens strange.

@override public void ontextchanged(charsequence s, int start, int before, int count) {     log.i("ontextchanged", "count: "+ count + " before: " + before);     if (before > count) {         ...     } } 

when write somthing in edittext, expect output in logcat this:

input: s

i/ontextchanged﹕ count: 1 before: 0 

input: so

i/ontextchanged﹕ count: 2 before: 1 

input: som

i/ontextchanged﹕ count: 3 before: 2 

input: som[space] //add space here

i/ontextchanged﹕ count: 4 before: 3 

what expect when remove space

input: som //remove space here

i/ontextchanged﹕ count: 3 before: 4 

but when removing space output says

input: som //remove space here

i/ontextchanged﹕ count: 3 before: 1 

what happend here? why before = 1 , not 4?


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -