'gets the x and y coordinates of the cursor in an EditText view
Private Sub GetEditTextXYCursor(edt As EditText) As Int()
Private joEditText, joLayout As JavaObject
Private PaddingLeft, PaddingTop, ScrollY, Pos, Line, LineBaseline As Int
Private xy(2) As Int
joEditText = edt
PaddingLeft = joEditText.RunMethod("getPaddingLeft", Null)
PaddingTop = joEditText.RunMethod("getPaddingTop", Null)
ScrollY = joEditText.RunMethod("getScrollY", Null)
' pos = edt.SelectionStart
Pos = joEditText.RunMethod("getSelectionStart", Null)
joLayout = joEditText.RunMethod("getLayout", Null)
Line = joLayout.RunMethod("getLineForOffset", Array As Object(Pos)) 'line numbsr
LineBaseline = joLayout.RunMethod("getLineBaseline", Array As Object(Line))
xy(0) = joLayout.RunMethod("getPrimaryHorizontal", Array As Object(Pos)) + PaddingLeft
xy(1) = LineBaseline + PaddingTop - ScrollY 'base line
Return xy
End Sub