Using EditText with TextWatcher - changed index ranges confusing?
<p>I'm having a hard time figuring out how we can use TextWatcher or KeyListener with an EditText to get notified of the following events:</p>

<ol>
<li>User has inserted text with start / end positions.</li>
<li>User has replaced text with start / end positions.</li>
</ol>

<p>TextWatcher has a few overrides but it looks like it operates on a "word" basis (tokenized by whitespace). For example, if the user already has the string:</p>

<pre><code>hello world
</code></pre>

<p>in the EditText, then they type the character 'z' at the end:</p>

<pre><code>hello worldz
</code></pre>

<p>my TextWatcher reports that 6 characters changed starting at index 6, replacing old text that had length 5. So typing a single character is telling me that the entire range of the word "world" has changed. This is confusing me, how can I keep track of the real range that has changed?</p>

<p>Thanks</p>
