Android Question Scan the code for help

bskotu555

Active Member
Is there a case where clicking a button, invoking the camera, reading a one-dimensional code or a QR code, and then filling the reading result into a text box?
 

jameshouser

New Member
Hello,
Yes, absolutely — that’s a common use case in B4A. You can open the camera, scan a 1D barcode or QR code, and then place the result into a TextField (EditText).

The easiest way is to use the BarcodeScanner library (based on Google ML Kit or ZXing). For example:
B4X:
Sub ButtonScan_Click

    Dim scanner As BarcodeScanner

    scanner.Initialize("scanner")

    scanner.Show  'Opens the camera and scans

End Sub



Sub scanner_BarcodeFound (Barcode As String)

    EditText1.Text = Barcode

End Sub
 
Upvote 0

bskotu555

Active Member
Upvote 0
Top