Android Question CameraExClass, how to specifie EAN13 barcode as parameter of createdetector

Sergio83

Active Member
Licensed User
Longtime User
Hello everybody,

I'm currentky using one of my apps based on CameraExClass to scan QR-CODE. But for a new purpose I have to scan EAN13 barcode. I didn't find, in spite of deep googling, the string to use to specify EAN13 as parameter for CreateDetector sub.

If someone of you know the answer, it will be great of him (her) to help me!

Have a nice hot weekend all of you
 

TILogistic

Expert
Licensed User
Longtime User
See this:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    toast.Initialize(Root)
    StopCamera
    B4XPages.SetTitle(Me, "Barcode Example")
    #if B4A
    CreateDetector (Array("CODE_128", "CODE_93", "QR_CODE", "EAN_13"))
    #Else if B4i
    scanner.Initialize2("scanner", pnlPreview, Array(scanner.TYPE_93, scanner.TYPE_128, scanner.TYPE_QR, scanner.TYPE_EAN13))
    Wait For Scanner_Ready (Success As Boolean)
    If Success = False Then
        btnStartStop.Enabled = False
        toast.Show("Failed to initialize the scanner.")
    End If
    #end if
End Sub


And for EAN-13 in B4A it's EAN_13
 
Upvote 0

Sergio83

Active Member
Licensed User
Longtime User
Thanks for your help, but unfortunately, I already tried that approach without success.
I’m going to work around this issue by managing a map by myself, where the keys are the barcode names I’ve defined and the values are the binary patterns corresponding to the builder's "setBarcodeFormat" method.
I ran a test by forcing the value to 160 (128 for QR code and 32 for EAN13), and it works.
However, I would prefer not to modify the "CreateDetector" subroutine, but rather use the correct label for EAN13.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?
read:

Captura de pantalla 2026-07-06 060145.png


Captura de pantalla 2026-07-06 060056.png


Captura de pantalla 2026-07-06 055955.png
 
Upvote 0

Sergio83

Active Member
Licensed User
Longtime User
I implemented my workaround code and it works; I had already consulted the suggested site, which is how I found the constants to use for specifying the barcode type to detect.
However, I didn't find a list of labels to specify as parameters of CreateDetector sub (may be a missunderstanding).
I need to point out a typo in my post #3: the constant for QR_CODE is not 128, but 256.
Anyway I thank you very much for your help TILogistic
Have a good summer time!
 
Upvote 0
Top