Android Question bluetooth barcode scanner - how to trap tab key suffix

cwt

Active Member
Licensed User
Longtime User
I am using a bluetooth scanner to input strings into an EditText view. The scanner is programmed to add a tab key as the suffix to the scanned string.

I need to trap the tab key, Chr(9), so I can process the data.

I am using a "TextChanged" sub for the EditText view as shown in the code below:

B4X:
Sub Part_Number_TextChanged (Old As String, New As String)
    If New = "" Then
        Return
    End If
    Dim NewLen As Int
    New.ToUpperCase
    If New.EndsWith(Chr(9)) = True Then
        NewLen = New.IndexOf(Chr(9))
        Part_Number.Text = New.SubString2(0,NewLen)
        Part_Number.Text.Trim
        AddItem
    End If
End Sub

The code above is not seeing the tab key suffix - apparently only viewable ascii characters are trapped in the TextChanged sub.

How can I do this?
 
Top