This is a wrap for this Github project. You will need to download ZxingLatest.jar from the link below and copy it to your additional library folder:
https://drive.google.com/file/d/0B4g9tud5lvjgOGxENXZZcjVrZDA/view?usp=sharing
Extract LibRes.zip and copy the folder and its contents to be on the same folder level as that of the B4A project's /Files and /Objects folders.
Copy the other B4A library files (attached) to your additional library folder.
Nothing of interest happening in the B4A manifest file.
Have done this B4A V7.30 and on a KitKat device. It should work with earlier versions of B4A (and in all probability with Android versions earlier and later than KitKat)
Once the app started - click on the centre of the black square
Scan a code
To scan another code - click on the previously scanned/displayed barcode
Have tested it with:
Aztex codes
QR codes
PDF417
EAN13
DataMatrix
Sure a whole number of other barcode types can also be scanned as the decoding is done by the Zxing engine.
Sample Code:
Library:
CodeScanner
Author: Github: Yuriy Budiyev, Wrapped by: Johan Schoeman
Version: 1
https://drive.google.com/file/d/0B4g9tud5lvjgOGxENXZZcjVrZDA/view?usp=sharing
Extract LibRes.zip and copy the folder and its contents to be on the same folder level as that of the B4A project's /Files and /Objects folders.
Copy the other B4A library files (attached) to your additional library folder.
Nothing of interest happening in the B4A manifest file.
Have done this B4A V7.30 and on a KitKat device. It should work with earlier versions of B4A (and in all probability with Android versions earlier and later than KitKat)
Once the app started - click on the centre of the black square
Scan a code
To scan another code - click on the previously scanned/displayed barcode
Have tested it with:
Aztex codes
QR codes
PDF417
EAN13
DataMatrix
Sure a whole number of other barcode types can also be scanned as the decoding is done by the Zxing engine.
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: b4aCodeScanner
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\LibRes
#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 cs1 As CodeScannerView
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")
cs1.MaskColor = Colors.ARGB(100, 0, 0, 200)
cs1.FrameColor = Colors.Yellow
cs1.FrameWidth = 5.0
cs1.SquareFrame = True
cs1.FrameCornersSize = 80
cs1.ShowToastMessage = True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
cs1.stopPreview
End Sub
Sub cs1_scan_result(result As String)
Log("B4A = " & result)
End Sub
Library:
CodeScanner
Author: Github: Yuriy Budiyev, Wrapped by: Johan Schoeman
Version: 1
- CodeScannerView
Events:- scan_result (result As String)
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImageNew (arg0 As Bitmap) As BitmapDrawable
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- stopPreview
- android.permission.CAMERA
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- FrameColor As Int [write only]
Set color of the frame - FrameCornersSize As Int [write only]
Set length on the frame corners - FrameWidth As Int [write only]
Set frame width - Height As Int
- Left As Int
- MaskColor As Int [write only]
Set color of the space outside of the framing rect - Padding()() As Int
- Parent As Object [read only]
- ShowToastMessage As Boolean [write only]
Show or dont show the Toast Message
Default value is set to True - SquareFrame As Boolean [write only]
Set whether frame is square or a rectangle - Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
Attachments
Last edited: