Android Question How to auto-advance a input field

rpitts78242

Member
Licensed User
Longtime User
I have an application where the user inputs a fixed length numeric value. I am needing to create a input field which is only X characters long, and once all the characters are entered, I want the option to submit that value for processing or advance to another on-screen field. How would you recommend creating a auto-advance field with submit option subroutine?

Thank you for your suggestions!
 

Mahares

Expert
Licensed User
Longtime User
Suppose you have 2 edittext views: txtTest and txtTest2. You can do the following:

B4X:
Dim z As Int =5
Sub txtTest_TextChanged (Old As String, New As String)
     If IsNumber(New) AND New.Length=z Then txtTest2.RequestFocus
End Sub
You can also execute a sub like this:
B4X:
Sub txtTest_TextChanged (Old As String, New As String)
   If IsNumber(New) AND New.Length=z Then msg
End Sub
Sub msg
   Msgbox("I jumped here","")
End Sub
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…