It is a shortcut wrap for this open source Github project:
1. Extract core-3.2.2-20150819.125554-1.zip and copy the extracted jar to your additional library folder
2. Extract DemoRes1.zip and copy the folder with its contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project
3. Extract DemoRes2.zip and copy the folder with its contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project
4. Copy attached ZxingEmbedded.jar and ZxingEmbedded.xml to your additional library folder
Take note of the B4A manifest file - there is a lot of unnecessary entries in it but I just copied and amended it from another B4A project that I have posted before.
Have tested this on an Android 7.0 device with B4A V7.3
You can set various parameters eg laser color, laser width, result color, result point color, point size, mask color.
It should support multiple languages - see various "values" folders in folder DemoRes2
It raises an event in the B4A project (zipped B4A project attached) that returns the barcode data (1D, 2D) as well as the barcode type.
Java code also attached - I have made some changes to the original code of ViewfinderView.java and CaptureManager.java
Enjoy!
Sample Code:
1. Extract core-3.2.2-20150819.125554-1.zip and copy the extracted jar to your additional library folder
2. Extract DemoRes1.zip and copy the folder with its contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project
3. Extract DemoRes2.zip and copy the folder with its contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project
4. Copy attached ZxingEmbedded.jar and ZxingEmbedded.xml to your additional library folder
Take note of the B4A manifest file - there is a lot of unnecessary entries in it but I just copied and amended it from another B4A project that I have posted before.
Have tested this on an Android 7.0 device with B4A V7.3
You can set various parameters eg laser color, laser width, result color, result point color, point size, mask color.
It should support multiple languages - see various "values" folders in folder DemoRes2
It raises an event in the B4A project (zipped B4A project attached) that returns the barcode data (1D, 2D) as well as the barcode type.
Java code also attached - I have made some changes to the original code of ViewfinderView.java and CaptureManager.java
Enjoy!
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: b4aZxingEmbedded
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\DemoRes1
#AdditionalRes: ..\DemoRes2
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private zxem As ZxingEmbedded
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
zxem.Initialize("zxem")
zxem.MaskColor = Colors.ARGB(100, 0, 0, 255)
zxem.LaserColor = Colors.White
zxem.ResultColor = Colors.Red
zxem.ResultPointColor = Colors.Cyan
zxem.ResultPointSize = 25
zxem.LaserWidth = 26
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
zxem.BeginScan
End Sub
Sub zxem_scan_result(barcodetext As String, barcodetype As String)
Log("in b4a barcodetext = " & barcodetext)
Log("in b4a barcodetype = " & barcodetype)
End Sub
Attachments
Last edited: