I want to have an Edit Text with a Character limit of 20. So after 20 characters have been entered, stop the typing.
B4X:
Dim IME As IME
Dim edtTest As EditText
edtTest.Initialize("")
IME.Initialize("")
IME.SetLengthFilter(edtTest, 20)
I've tried using the above code inside Activity_Create. I load librarie IME.
But nothing happened .... did not introduce an error nor did it prevent the typing.
If you have the edit text created in the Designer, do not initialize it. That is why you are getting nothing. The below code works.
B4X:
Sub Globals
Dim IME As IME
Dim edtTest As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout1")
edtTest.Color=Colors.Red
IME.Initialize("IME")
IME.SetLengthFilter(edtTest, 20)
End Sub