I'm looking for a way to detect a cursor position changed in an EditText. I couldn't find anything in the documentation so far. Has anyone solved this already?
Android: EditText listener for cursor position change [duplicate]
Asked Answered
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)
Thanks. Stupid me. I must have missed that :-( –
Hijack
Sorry for the stupid question, but I'm new to Android development, so could you give me an example of using onSelectionChange? Eclipse doesn't seem to list that function when I try to apply it to an EditText. Is it not available for SDK version 1.5? –
Razor
onSelectionChanged is available since API Level 3, i.e. Android 1.5. It is an overridable in TextView, the base class of EditText, so be sure to check the overridables of TextView in the Eclipse dialog. –
Bellina
© 2022 - 2024 — McMap. All rights reserved.