Android Question Get current EditText1.Text.Length

Douglas Farias

Expert
Licensed User
Longtime User
hi all
how can i get a current text length ?

for example , i have a text with 4000 chars at one edittext
i m on 2222 for example, how to get this value?

i need this because i m need edit some lines and later press a button, when i press a button edittext.text change and the cursor back to length = 0 and not the last edited text line 2222

how can i make this? save the current length number?
 

Mahares

Expert
Licensed User
Longtime User
Have you thought about edittext.selectionStart:
B4X:
Sub txtTest_TextChanged (Old As String, New As String)
    Dim cposition As Int
     cposition=txtTest.SelectionStart
    Log(cposition)
End Sub
or
B4X:
Sub txttest_EnterPressed
    Dim cposition As Int
    cposition=txtTest.SelectionStart
    Log(cposition)
End Sub
 
Upvote 0
Top