I am trying to find out how to get the cursor position when the user clicks inside a edittext!
with this it will help me read the word inside the edit text that the user focused on it in order to modify it ...but I want the cursor position before any other text inside to change
with this it will help me read the word inside the edit text that the user focused on it in order to modify it ...but I want the cursor position before any other text inside to change
B4X:
'The code below does not seem to work due to the focuschanged event that is not starting
Sub getSelectionStart(edt As EditText) As Int
Dim jo = edt As JavaObject
jo.RunMethod("getSelectionStart", Null)
End Sub
Sub editvorbe_FocusChanged (HasFocus As Boolean)
Dim position As Int
position=getSelectionStart(editvorbe)
ToastMessageShow(position,True)
End Sub
'the sub below works but does not help at all because
' it returns the cursor position only if the user does modify the word inside by adding 'letter or deleting which actually make the word that was focused with the cursor change
'and I will not read what was the word that was modified
Sub editvorbe_TextChanged (Old As String, New As String)
Log(editvorbe.SelectionStart)
End Sub