B4A Library Barcode Scanner - 100% embedded within B4A (15 Feb 2016 : New library files in Post #105)

The attached project wraps this Github project. It is a barcode scanner based on the ZXING project. I have successfully scanned the following 1D and 2D barcodes:
1. Code 39
2. Code 93
3. Code 128
4. Two-of-Five Interleaved (TFI)
5. EAN13
6. EAN8
7. PDF417
8. QR Code
9. Aztec Code
10. Codabar

It is 100% embedded within the B4A project via a CustomView. Thus, you can add buttons, background images, background colors, labels, textviews, or whatever you like to the activity via the designer or via code. It does not have all the bells and whistles that the ZXING project offers (i.e ability to set the laser color etc) but it works 100% within B4A. It does not take over control of the B4A activity - set the size (width / height / left / top) of the CustomView in the B4A code and that will be the size of your barcode View Finder. Add buttons to start and stop the scanner. It is as simple as that.

For as long as what the scanner is active it will scan 1D/2D barcodes i.e no need to stop and start the scanner to start scanning a new barcode. Just point the scanner at the next barcode to scan.

I have added the following events to the B4A project:
1. scanresult - here you can get the decoded string/text result when a successful scan occurred
2. scanner_started - this event is raised when the scanner is activated via B4A code
3. scan_error - sorry, but have not seen this event in action yet as I have had no miss scans thus far
4. scanner_stopped - this event is raised when the scanner is stopped.

There are a number of files in the B4A project's Object/res/..... folders that are set to read only. Keep them like that.

There are permissions added to the B4A manifest - make sure you take note of it should you start a new B4A project.

You will need core-3.1.0.jar and android-support-v4.jar to be in your additional library folder. I have zipped them together - you can download them from HERE. Extract them from the zipped file and copy them to your additional library folder.

1.png


2.png


Some sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: zxScannerLiveView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#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 zxslv As zxScannerLiveView
    Private b1 As Button
    Private b2 As Button
    Private l1 As Label

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")

    zxslv.Initialize("zxslv")

    Activity.AddView(zxslv, 50%x - 45%y, 5%y, 90%y, 90%y)

    zxslv.HudVisible = True
    zxslv.PlaySound = True
    zxslv.Visible = False

End Sub

Sub Activity_Resume


End Sub

Sub Activity_Pause (UserClosed As Boolean)

    zxslv.Visible = False
    zxslv.stopScanner

End Sub

Sub b1_Click

    zxslv.Visible = True
    zxslv.startScanner

End Sub
Sub b2_Click

    zxslv.Visible = False
    zxslv.stopScanner
    l1.Text = ""

End Sub

Sub zxslv_scanresult

    Log(zxslv.ScanResult)
    l1.Text = zxslv.ScanResult

End Sub

Sub zxslv_scanner_started

    Log("Scanner Started")

End Sub

Sub zxslv_scan_error

    Log("Scan Error")

End Sub

Sub zxslv_scanner_stopped

    Log("Scanner stopped")

End Sub


And this will add a coloured frame around the view finder - making use of panels via B4A code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: zxScannerLiveView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#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 zxslv As zxScannerLiveView
    Private b1 As Button
    Private b2 As Button
    Private l1 As Label
    Private l2, l3, l4, l5 As Label

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")

    zxslv.Initialize("zxslv")
    Dim framecolor As Int = Colors.Red

    l2.Initialize("")
    l3.Initialize("")
    l4.Initialize("")
    l5.Initialize("")

    Activity.AddView(zxslv, 50%x - 45%y, 5%y, 90%y, 90%y)
    Activity.AddView(l2, 50%x - 45%y - 1%y, 4%y, 1%y, 92%y)
    Activity.AddView(l3, 50%x + 45%y, 4%y, 1%y, 92%y)
    Activity.AddView(l4, 50%x - 45%y - 1%y, 4%y, 91%y, 1%y)
    Activity.AddView(l5, 50%x - 45%y - 1%y, 5%y + 90%y, 91%y, 1%y)


    l2.Color = framecolor
    l2.Visible = False

    l3.Color = framecolor
    l3.Visible = False

    l4.Color = framecolor
    l4.Visible = False

    l5.Color = framecolor
    l5.Visible = False

    zxslv.HudVisible = True
    zxslv.PlaySound = True
    zxslv.Visible = False


End Sub

Sub Activity_Resume


End Sub

Sub Activity_Pause (UserClosed As Boolean)

    zxslv.Visible = False
    zxslv.stopScanner

    l2.Visible = False
    l3.Visible = False
    l4.Visible = False
    l5.Visible = False

End Sub

Sub b1_Click

    zxslv.Visible = True
    zxslv.startScanner

    l2.Visible = True
    l3.Visible = True
    l4.Visible = True
    l5.Visible = True

End Sub
Sub b2_Click

    zxslv.Visible = False
    zxslv.stopScanner
    l1.Text = ""

    l2.Visible = False
    l3.Visible = False
    l4.Visible = False
    l5.Visible = False



End Sub

Sub zxslv_scanresult

    Log(zxslv.ScanResult)
    l1.Text = zxslv.ScanResult

End Sub

Sub zxslv_scanner_started

    Log("Scanner Started")

End Sub

Sub zxslv_scan_error

    Log("Scan Error")

End Sub

Sub zxslv_scanner_stopped

    Log("Scanner stopped")

End Sub

It will look like this:

3.png


zxScannerLiveView
Author: Github: Dmitri Livotov, Wrapper: Johan Schoeman
Version: 1



zxScannerLiveView
Events:

  • scan_error ( )
  • scanner_started ( )
  • scanner_stopped ( )
  • scanresult ( )
Fields:
  • BACK As String
  • FRONT As String
  • ba As BA
  • mfrontOrBack As String
Methods:
  • 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
  • SetBackgroundImage (arg0 As Bitmap)
  • 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)
  • startScanner
    Starts scanner, using device default camera
  • stopScanner
    Stops currently running scanner
  • toggleFlash
Properties:
  • BackgroudImage As String [write only]
  • Background As Drawable
  • CameraToUse As String [write only]
  • Color As Int [write only]
  • Enabled As Boolean
  • Height As Int
  • HudVisible As Boolean [write only]
  • Left As Int
  • PlaySound As Boolean [write only]
  • SameCodeRescanProtectionTime As Long [write only]
  • ScanResult As String [read only]
  • Tag As Object
  • Top As Int
  • Visible As Boolean
  • Width As Int
You can download and test any posting of mine in this thread but if you want to use it then you need to
 

Attachments

  • zxScannerLiveViewLibFiles.zip
    44.9 KB · Views: 3,342
  • b4aZXscannerLiveView.zip
    19 KB · Views: 3,278
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
Douglas, if anything it must be underlying to the Github project that I have wrapped. I am running it on a Samsung S4 mini and it scans like a dream. No delay whatsoever. I have noticed it to be a bit lazy when scanning PDF417 and Aztec codes but I have had very very fast response for QR Codes and all the 1D codes. I have brought the laziness of the PDF417 codes and the Aztec Codes to the attention of Dmitri Livotov, the author of the Github project. If there is an update for it I will amend my lib accordingly and post a new library. But as mentioned above, I get very very good response with it on my S4. No worse than the Icefairy lib that I have modified or that of the QRCP4 project that I have posted on the forum.
yes i know, i m only trying understand why sometimes this read fast and sometimes no, what can cause this delay, any ideia?
sometimes i only put on qr code and this read very fast 1s- but sometimes i need wait 5s+
 

Johan Schoeman

Expert
Licensed User
Longtime User
yes i know, i m only trying understand why sometimes this read fast and sometimes no, what can cause this delay, any ideia?
sometimes i only put on qr code and this read very fast 1s- but sometimes i need wait 5s+
Douglas, I think it probably has a lot to do with how good the image frame is that was captured by the camera. This library has its own "Capture Activity" that capture frames and passes them on to the ZXING core to decode. I have timed the original ZXING library before (adding a LOG statement to the ZXING code and then writing a "hey, I am here" to the B4A log to see how often a frame gets passed to the ZXING core library. It happens about 8 times per second. But once the frame has been passed there are a lot of things happening in the ZXING core code. The image must be binarized with something like local or global thresholding, the finding patterns must be identified within the QR code, the image must be cropped, all ""noise" around the QR code must be eliminated, geometric corrections need to take place to try and correct for whatever skewness there might be, the decoding must take place, error correction needs to be done, etc, etc. Thus, if the ZXING core code are not able to 100% identify or decode a QR code or any barcode for that matter from the frame that was passed to it, it will reject the frame and try a new frame that it received. It is almost like a "perfect storm" that needs to come together for a successful scan. Also probably a lot to do with camera capability. But my S4 mini is motoring through successive scans - perhaps just the right camera for the job. Even the front camera has no issue whatsoever. It reads whatever barcode I am pointing it at in no time at all.

I will try it on my tablet and see what it does but I expect it to be pathetic as it has a very low resolution camera.
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
@Johan Schoeman
why this is slow to read a code?

i m trying to read a qr code, but i need stay 7/10 seconds to read, and the camera have focus.
tested on 2 devices. what can is this? i will make a video to show u
sometimes read fast, but only sometimes.


edit
sorry for bad video xD
i m with iphone on one hand and e4 on another xD

look at first scan, this is slow (5s), later is fast i dont know what cause the slow on scan
I have scanned the code in your video without the scanner on my S4 having to think about it - even from as far away from my computer screen as 30cm....It found it immediately...

1.png
 

b4auser1

Well-Known Member
Licensed User
Longtime User
Thank you very much for this lib.

I built-in it to my application and it works great. I use special buttons with icons to change camera (Front, Back) and Flash On/Off.
I change icon for the button to reflect the current state of Camera or Flash. I don't have any problems with icons for the camera, but the method "toggleFlash" doesn't allow to detect the current state of Flash.
Sure, I can use Camera_Ex class to detect the state of flash, but it would be better to avoid it and have opportunity to detect the current state of Flash using only zxScannerLiveView.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Thank you very much for this lib.

I built-in it to my application and it works great. I use special buttons with icons to change camera (Front, Back) and Flash On/Off.
I change icon for the button to reflect the current state of Camera or Flash. I don't have any problems with icons for the camera, but the method "toggleFlash" doesn't allow to detect the current state of Flash.
Sure, I can use Camera_Ex class to detect the state of flash, but it would be better to avoid it and have opportunity to detect the current state of Flash using only zxScannerLiveView.
Here you go. New library files attached. See changes to code in the B4A project with comment dated 20 November 2015. Sure you will figure it out....:)

B4X:
#Region  Project Attributes
    #ApplicationLabel: zxScannerLiveViewNew
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#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 zxslv As zxScannerLiveView
    Private b1 As Button
    Private b2 As Button
    Private l1 As Label
    Private l2, l3, l4, l5 As Label
  
    Private b3 As Button
    Private scanStarted As Boolean = False
  
    Private Spinner1 As Spinner
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")
  
    zxslv.Initialize("zxslv")
    Dim framecolor As Int = Colors.Red
  
    l2.Initialize("")
    l3.Initialize("")
    l4.Initialize("")
    l5.Initialize("")
  
    Activity.AddView(zxslv, 50%x - 45%y, 5%y, 90%y, 90%y)
'    Activity.AddView(zxslv, 5%x, 50%y - 45%x, 90%x, 90%x)  
    Activity.AddView(l2, 50%x - 45%y - 1%y, 4%y, 1%y, 92%y)
    Activity.AddView(l3, 50%x + 45%y, 4%y, 1%y, 92%y)
    Activity.AddView(l4, 50%x - 45%y - 1%y, 4%y, 91%y, 1%y)  
    Activity.AddView(l5, 50%x - 45%y - 1%y, 5%y + 90%y, 91%y, 1%y)
  
'    zxslv.BackgroudImage = "target"                          'ADDED 12 Nov 2015 - use this to add your own image/aim/target to the scanner - see target.png that I have added
                                                             'to the Objects/res/drawable folder (it should preferably have a transparent background)
  
    Spinner1.AddAll(Array As String("FRONT", "BACK"))  
  
  
    l2.Color = framecolor
    l2.Visible = False
  
    l3.Color = framecolor
    l3.Visible = False
  
    l4.Color = framecolor
    l4.Visible = False  
  
    l5.Color = framecolor
    l5.Visible = False

    zxslv.HudVisible = True
    zxslv.PlaySound = True
    zxslv.Visible = False
  
    zxslv.SameCodeRescanProtectionTime = 2000              'ADDED 12 NOV 2015 - interval before the same code will be scanned again (milliseconds)
  
  
End Sub

Sub Activity_Resume
  

End Sub

Sub Activity_Pause (UserClosed As Boolean)
  
    zxslv.Visible = False
    zxslv.stopScanner
  
    l2.Visible = False
    l3.Visible = False
    l4.Visible = False  
    l5.Visible = False      
  
End Sub

Sub b1_Click
  
    If Spinner1.SelectedItem = "BACK" Then
        zxslv.CameraToUse = zxslv.BACK   'or FRONT (i.e it sets the camera to use. If you specify FRONT and there is no FRONT camera it will revert to the back camera
    Else
        zxslv.CameraToUse = zxslv.FRONT  'or BACK (i.e it sets the camera to use. If you specify FRONT and there is no FRONT camera it will revert to the back camera
    End If
  
                                           
    zxslv.Visible = True
    zxslv.startScanner
  
    l2.Visible = True
    l3.Visible = True
    l4.Visible = True
    l5.Visible = True      
  
End Sub
Sub b2_Click
  
    zxslv.Visible = False
    zxslv.stopScanner
    l1.Text = ""
  
    l2.Visible = False
    l3.Visible = False
    l4.Visible = False
    l5.Visible = False      
  
End Sub

Sub zxslv_scanresult
  
    Log(zxslv.ScanResult)
    l1.Text = zxslv.ScanResult
  
End Sub

Sub zxslv_scanner_started
  
    scanStarted = True
    Log("Scanner Started")
  
End Sub

Sub zxslv_scan_error
  
    Log("Scan Error")
  
End Sub

Sub zxslv_scanner_stopped
    scanStarted = False
    Log("Scanner stopped")
  
End Sub

Sub zxslv_scanner_touched                     'Added 20 November 2015

    Log(zxslv.isTorchOn)                      'Added 20 November 2015
  
End Sub

Sub b3_Click
  
    If scanStarted = True Then
      zxslv.toggleFlash
      Log(zxslv.isTorchOn)                    'Added 20 November 2015
    End If
  
End Sub


zxScannerLiveView
Author:
Github: Dmitri Livotov, Wrapper: Johan Schoeman
Version: 1
  • zxScannerLiveView
    Events:
    • scan_error ( )
    • scanner_started ( )
    • scanner_stopped ( )
    • scanner_touched ( )
    • scanresult ( As )
    Fields:
    • BACK As String
    • FRONT As String
    • ba As BA
    • mfrontOrBack As String
    Methods:
    • 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
    • SetBackgroundImage (arg0 As Bitmap)
    • 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)
    • isTorchOn As Boolean
    • startScanner
      Starts scanner, using device default camera
    • stopScanner
      Stops currently running scanner
    • toggleFlash
    Properties:
    • BackgroudImage As String [write only]
    • Background As Drawable
    • CameraToUse As String [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • HudVisible As Boolean [write only]
    • Left As Int
    • PlaySound As Boolean [write only]
    • SameCodeRescanProtectionTime As Long [write only]
    • ScanResult As String [read only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • zxScannerLiveViewLibFiles.zip
    47 KB · Views: 487
  • b4aZXscannerLiveViewTorchOnOff.zip
    76.4 KB · Views: 489
Last edited:

Bryanne Vega

Member
Licensed User
Longtime User
There needs to be a way to limit the area of coverage of the scanner to avoid scanning different bar codes when there's multiple on the area.

Could you implement a way that it will only scan or read whatever is inside of the red box?

Also have some pre-determined sizes (most common types of 2D bar codes) so we can set the red box faster.

I think that's a possible solution to our problem.
 

Johan Schoeman

Expert
Licensed User
Longtime User
There needs to be a way to limit the area of coverage of the scanner to avoid scanning different bar codes when there's multiple on the area.

Could you implement a way that it will only scan or read whatever is inside of the red box?

Also have some pre-determined sizes (most common types of 2D bar codes) so we can set the red box faster.

I think that's a possible solution to our problem.
Not unless I go and amend major portions of the original Github and ZXING code - of which I have no intentions to do...:)

The red box is just an overlay. It has nothing to do with the size of the scanner window. Just a gimmick for special appearance. You can change it to whatever you like. See one of the previous posts where I changed it.

Make the view smaller or hold the device closer to limit the exposure to other barcodes in the adjacent area...
 
Last edited:

Bryanne Vega

Member
Licensed User
Longtime User
Then it's time to visit that GitHub. Thanks tho, it's working beautiful either way, I know in the future it will be better!
 

Mahares

Expert
Licensed User
Longtime User
There needs to be a way to limit the area of coverage of the scanner to avoid scanning different bar codes when there's multiple on the area.
1. As Johan mentioned to you, the red box is very misleading and has no effect on the sacnning. You can hide it by putting this line:
zxslv.HudVisible = False
2. If you want to limit the area of scan coverage because your barcodes are crowded, you can add the zxScannerLiveView via designer by using smaller dimentions or by code like this:
zxslv.Initialize("zxslv")
Activity.AddView(zxslv, 50%x - 45%y, 5%y, 30%y, 30%y)
 

Bryanne Vega

Member
Licensed User
Longtime User
1. As Johan mentioned to you, the red box is very misleading and has no effect on the sacnning. You can hide it by putting this line:
zxslv.HudVisible = False
2. If you want to limit the area of scan coverage because your barcodes are crowded, you can add the zxScannerLiveView via designer by using smaller dimentions or by code like this:
zxslv.Initialize("zxslv")
Activity.AddView(zxslv, 50%x - 45%y, 5%y, 30%y, 30%y)


Now that you mention this, consider this:

What if we could *pitch* in and out of the view, making it bigger or smaller, to limit the area of coverage? <<<<<<<Perfect +1 Like Hah :)
 

incendio

Well-Known Member
Licensed User
Longtime User
I just got my time to test this great library again.

I thought scanning speed related with zxScannerLiveView size, but I was wrong.

Speed is definitely related with orientation. With the same zxScannerLiveView size, using latest library on post #45, on landscape mode, speed is no problem, but on portrait mode, there are some problems :
1) speed is very slow
2) I have a few lines up barcodes (2d) , I made my zxScannerLiveView size just to fit only 1 barcode. On my phone's screen, camera shows barcode 12345, but when scan done, it read barcode 12346 which is the next barcode on the line
3) sometimes even I have stop the scanner (zScaner.stopScanner), the app still reads barcodes
 

peacemaker

Expert
Licensed User
Longtime User
Thanks for your great lib !
But i made testing and comparing with a scann app basing on zbar: https://play.google.com/store/apps/details?id=com.allen2012.barcode
This app uses the auto-focus very good - and focusing is non-stop and focused in 2-4 secs for sure.

But this B4A lib project use auto-focus for a short time (1-2 secs) and camera has no enough time to focus well. Tested on the same device, EAN13 barcode at the same illumination.

How to improve auto-focusing of this lib?
 

Johan Schoeman

Expert
Licensed User
Longtime User
/
Thanks for your great lib !
But i made testing and comparing with a scann app basing on zbar: https://play.google.com/store/apps/details?id=com.allen2012.barcode
This app uses the auto-focus very good - and focusing is non-stop and focused in 2-4 secs for sure.

But this B4A lib project use auto-focus for a short time (1-2 secs) and camera has no enough time to focus well. Tested on the same device, EAN13 barcode at the same illumination.

How to improve auto-focusing of this lib?
I can suggest 1 of two things:

1. Use ZBAR that you have downloaded or
2. Modify the attached Java code to your liking, compile it into a library and then use it within your B4A project.

:)....enjoy!

You will have to modify the Java code of the original Github project and not the wrapper that I have created that interfaces with/wraps the Github project...
 

Attachments

  • TheJavaCode.zip
    29.4 KB · Views: 319

peacemaker

Expert
Licensed User
Longtime User
/
2. Modify the attached Java code to your liking, compile it into a library and then use it within your B4A project.

THanks for quick reply !
Can you re-compile the project with only single update ?

Change in src\eu\livotov\labs\android\camview\camera\v1\AutoFocusManager.java
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
into
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 5000L;
?
 

Johan Schoeman

Expert
Licensed User
Longtime User
THanks for quick reply !
Can you re-compile the project with only single update ?

Change in src\eu\livotov\labs\android\camview\camera\v1\AutoFocusManager.java
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
into
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 5000L;
?
Will modify so that you can set the auto focus time from your B4A project. Will do it tomorrow sometime and then post new lib files.
 

peacemaker

Expert
Licensed User
Longtime User
Thsnks, it's more than enough.
BTW, seems source project already has v.2 or 3
 

Johan Schoeman

Expert
Licensed User
Longtime User
Thsnks, it's more than enough.
BTW, seems source project already has v.2 or 3
I have the latest code in my library. Last update to the Github project was to sort out scanning of Datamatrix codes that I brought to the attention of Dmitri (author of the Github project).
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
THanks for quick reply !
Can you re-compile the project with only single update ?

Change in src\eu\livotov\labs\android\camview\camera\v1\AutoFocusManager.java
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
into
B4X:
private static final long AUTO_FOCUS_INTERVAL_MS = 5000L;
?
Here you go...new library files attached. Set the auto focus interval as follows:

B4X:
    zxslv.AutoFocusInterval = 5000
 

Attachments

  • zxScannerLiveViewLibFiles.zip
    47.1 KB · Views: 451

peacemaker

Expert
Licensed User
Longtime User
Here you go...new library files attached.
B4X:
    zxslv.AutoFocusInterval = 5000

Thanks much ! Works better, tested with 5 sec. Finally set 10 sec autofocus, but anyway - ZBAR sample scanner app looks like more stable recognizing, even without flashlight on.
But this lib maybe it's the best variant now. :)
 
Last edited:

Galbas_Portes

New Member
Licensed User
Longtime User
Hello! I've the Basic4Android v3.5 and I've problems when my app loads the line zxslv.Initialize("zxslv"). Somebody can help me?
Thanks.
 
Top