I have a dialog with EditText in it. The EditText is already populated when it is created. When the user places the cursor on or near certain parts of the text a Toast will pop up.
My problem is listening for changes in cursor position. Another post asks the same question and the accepted solution was
You can override onSelectionChanged (int selStart, int selEnd) to get notified about selection changes. If the cursor is moved, this is called as well (in this case selStart == selEnd)
onSelectionChanged (int selStart, int selEnd) is a protected method of the TextView class. How do override it?
Just subclass or extend the class EditText and add the following code to the newly create class:
Don’t forget to add constructors to the subclass. 🙂