Android has very good support for custom input method editors (IMEs). The downside for this powerful feature is that interacting with the soft keyboard can be sometimes quite complicated. This library includes several utilities that will help you better handle the soft keyboard. The attached...
If you want to automatically accept the number after 2 decimal places have been entered, you need to use IME to hide the keyboard. Some audio feedback may be required to let the user know the entry is complete.
'These global variables will be redeclared each time the activity is created.
Private EditText1 As EditText
Private beep As Beeper 'Audio library
Private IME1 As IME 'IME library (not IME2)
Sub Activity_Create(FirstTime As Boolean)
Private Sub EditText1_TextChanged (Old As String, New As String)
'Note: In designer, I set EditText1 to expect DECIMAL input. On numeric keyboards the minus sign requires two clicks on my Samsung device
If New.LastIndexOf("-") >0 Then Return 'prevents minus inside number
If New = "-" Then EditText1.TextColor = xui.Color_Red
Dim k As Int = New.IndexOf(".")
If k > -1 Then
If New.Length - k = 3 Then 'also prevents multiple periods, auto registers the amount and resets box when 2 decimal places are reached
Private Sub EditText1_EnterPressed
Log("Done Pressed " & EditText1.Text)
EditText1.Text = ""
EditText1.TextColor = xui.Color_Black
It worked as intended and also added the sound to help the user in typing.
Your help today has been very valuable to me. I managed to advance a few boxes.