KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm using the android.text.TextWatcher interface to listen to changes on an EditText in one of my apps. I monitor the changes to allow Undo options, using the beforeTextChanged() and onTextChanged(). Usually, changes happens one character at a time, for instance if the user types "hello", i'll get the following values for the start, after and count values of the beforeTextChanged() method : start = 0; count = 0; after = 1; // typed 'h' start = 1; count = 0; after = 1; // typed 'e' start = 2; count = 0; after = 1; // typed 'l' start = 3; count = 0; after = 1; // typed 'l' start = 4; count = 0; after = 1; // typed 'o' Now, on ICS / Samsung Galaxy Nexus, with the spelling suggestions active, when I type the same text, the word is underlined in the EditText until I insert a space and I get the following results : start = 0; count = 0; after = 1; // typed 'h' start = 0; count = 1; after = 2; // typed 'e' start = 0; count = 2; after = 3; // typed 'l' start = 0; count = 3; after = 4; // typed 'l' start = 0; count = 4; after = 5; // typed 'o' According to the documentation, the latter behavior is seen as "the user typed a 1 letter word, then erased it and typed a 2 letter words, then erased it and typed a 3 letter word, and so on...". And when I perform undos on the EditText, i get "hello", "", "hell", "", "hel", "", "he", "", "h", where I only want to have "hello", "". Is there a way to prevent the spelling suggestions to give these values. IMHO, this break the contract given in the method documentation. If not, is there a way to prevent the suggestion on my edit text ?
Tags (comma-separated)
Save Edits
Cancel