Android Question Clear EditText from Scanning

junaidahmed

Well-Known Member
Licensed User
Longtime User
I have an EditText with some Value,I would like to know to clear EditText When Scanning from external Barcode device...
 

DonManfred

Expert
Licensed User
Longtime User
Other apps (the barcodescanner) does not have the rights to change values in your app.

If you got the barcode sended to the edittext it is up to YOU to clear the edit to get the next barcode.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
if u have a Barcode reader as keyboard simulation (ex via Bluetooth connected), normal it send a line break char (return)
so u need process this text after the device simulate the enter key
and then set the text property to empty string.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hello
what I use to know if there is any value in the EditText is:
B4X:
Sub TxtBarCode_FocusChanged (HasFocus As Boolean)
    If TxtBarCode.Text.Length>=1 Then
        SearchPCod(TxtBarCode.Text)
    End If
End Sub
To clean the EditText in the SearchPCod function if it does not find the product is:

B4X:
ToastMessageShow("Product "&TxtBarCode.Text&" Does not exist",True)
TxtBarCode.Text =""
TxtBarCode.RequestFocus
I use a barcode reader connected by Bluetooth
 
Upvote 0
Top