B4A Library ZXingLib(integration version)by icefairy333

integration version
zxing 2.1 inside
no need to install zx scaner or other apk,just a jar and xml file copy it to b4a library dir,and then use it well.

demo:
B4X:
'Activity module
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.
Dim zx As Zxing_B4A
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("Layout1")
zx.BeginScan("myzx")
End Sub
Sub myzx_result(atype As String,Values As String)
   Log("type:"&atype&"values:"&Values)
   Msgbox("type:"&atype&"values:"&Values,"result")
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
and you must add last text to manifest editor:
B4X:
AddApplicationText(<activity android:name="ice.zxing.CaptureActivity"
         android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
         android:windowSoftInputMode="stateAlwaysHidden">
      </activity>)

lib doc:
b4aZXing
Author: IceFairy333
Version: 1.5
  • Zxing_B4A
    Events:
    • result (atype as String As , Values as String As )
    Fields:
    • isportrait As Boolean
    • useFrontCam As Boolean
    Methods:
    • BeginScan (EventName As String)
      please handle the event
      add this to manifest:<activity android:name="ice.zxing.CaptureActivity"
      android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
      android:windowSoftInputMode="stateAlwaysHidden"></activity>
    Permissions:
    • android.hardware.camera
    • android.hardware.camera.autofocus
    • android.permission.CAMERA
    • android.permission.FLASHLIGHT
    • android.permission.VIBRATE
    • android.permission.WRITE_EXTERNAL_STORAGE
lib doc:
b4aZXing
Author: IceFairy333
Version: 1.2
  • Zxing_B4A
    Events:
    • result (atype as String As , Values as String As )
    Methods:
    • BeginScan (EventName As String)
      please handle the event
      add this to manifest:<activity android:name="ice.zxing.CaptureActivity"
      android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
      android:windowSoftInputMode="stateAlwaysHidden"></activity>
    Permissions:
    • android.hardware.camera
    • android.hardware.camera.autofocus
    • android.permission.CAMERA
    • android.permission.FLASHLIGHT
    • android.permission.VIBRATE
    • android.permission.WRITE_EXTERNAL_STORAGE

anyone who has the scan twice,can download the library src to check it on your device,in my phone it works fine:signOops:

notice by Erel:The second scan happens because zx.BeginScan is called from Activity_Create. The activity is recreated when you change the orientation during the scanning.

The solution is simple. Move this call to a different sub (Button_Click for example).
 

Attachments

  • zxdemo&lib.zip
    255.5 KB · Views: 2,401
  • b4aZxingLibsrc.zip
    325.9 KB · Views: 2,063
  • b4azxing1.5.zip
    249.2 KB · Views: 2,152
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
use with quickmark

Hi is it possible to use this library with quickmark? I prefer quickmark's scanner.
 

walterf25

Expert
Licensed User
Longtime User
Barcode Reader

Hi Icefairy and everyone else, I was wondering would it be too much work to add the capability to your java code so that the scanning part can be done within a panel in the same activity without opening a different activity getting the results then returning to the previous activity.
I find this library very awesome, i'm working on an app for one of my clients and so far everything works great, haven't tested it on other devices but so far everything seems to be working great.
I would love to have this feature added so that i can scan a barcode within the same activity.

Thanks,
Walter
 

sorex

Expert
Licensed User
Longtime User
I tried this on my tablet, works fine but seems to be less accurate than using the 3rd party one as it took longer to get the same barcode scanned.

Is this due to the smaller scanning screen?
 

icefairy333

Active Member
Licensed User
Longtime User
Hi Icefairy and everyone else, I was wondering would it be too much work to add the capability to your java code so that the scanning part can be done within a panel in the same activity without opening a different activity getting the results then returning to the previous activity.
I find this library very awesome, i'm working on an app for one of my clients and so far everything works great, haven't tested it on other devices but so far everything seems to be working great.
I would love to have this feature added so that i can scan a barcode within the same activity.

Thanks,
Walter
Scanning with a panel is very difficult.
 

walterf25

Expert
Licensed User
Longtime User
Buy Library message

Hi Icefairy, i did an application for one of my customers using this great library, everything works perfect except that today i got an e-mail from him saying that he had received a message asking to purchase the library, can this library only be used for a certain amount of uses for a certain amount of time?
If that is the case then every person who installs this my app with this library in it will need to purchase the library. Have you gotten any messages like this? I have not seen the message personally, i'm still waiting for a screenshot from my customer.

Any ideas?

Thanks,
Walter
 

bluedude

Well-Known Member
Licensed User
Longtime User
I haven't seen this message either but would be good to get confirmation by the author. I'm preparing a release too with this library.

Cheers,
 

walterf25

Expert
Licensed User
Longtime User
Bar Code Scanner

Yes, i have been testing it on my phone, and so far i haven't seen that message either, i'm still waiting from my customer to reply and to verify if that message they saw is from the app i made or possibly from another app they have installed.

I hope IceFairy can shed some light on this!
 

AHilton

Active Member
Licensed User
Longtime User
WalterF25,

Any word from your customer about the 'purchase the library' message?

I've been running this on 3 of my development devices since IceFairy posted the library and 3 beta test devices pretty extensively for about a month and a half without having a message come up. But, the release date is getting close and I'd hate to have this wreck it.

By the way, I guess I'm not having as many problems as some have reported in barcode recognition. It's pretty darn good and in some poor lighting conditions, too (industrial environment). I control the barcode printing, so that might have a little to do with it although the barcode printer I'm testing with is a very old Zebra and doesn't print the best barcodes I've ever seen either. Of course, not every phone or tablet camera is suitable for it and I've had to do some testing to be sure what I can certify as compatible with the app.

I can report that the new Samsung Galaxy Note 8 does work well with this library along with the old ASUS TF300T tablet, Motorola Atrix 4G and various other old phones.
 

walterf25

Expert
Licensed User
Longtime User
Barcode App

Hi there, fortunately the message has not popped up anymore, although I believe it was a confusion, I believe my client must have had another Barcode App installed which popped up that message and he must have gotten it confused with my app, I have checked with them and they have not gotten that message again.

Ewwww, as far as reliability this library has also been working great for me, THANK YOU Icefiary :sign0060:

Regards,
Walter

WalterF25,

Any word from your customer about the 'purchase the library' message?

I've been running this on 3 of my development devices since IceFairy posted the library and 3 beta test devices pretty extensively for about a month and a half without having a message come up. But, the release date is getting close and I'd hate to have this wreck it.

By the way, I guess I'm not having as many problems as some have reported in barcode recognition. It's pretty darn good and in some poor lighting conditions, too (industrial environment). I control the barcode printing, so that might have a little to do with it although the barcode printer I'm testing with is a very old Zebra and doesn't print the best barcodes I've ever seen either. Of course, not every phone or tablet camera is suitable for it and I've had to do some testing to be sure what I can certify as compatible with the app.

I can report that the new Samsung Galaxy Note 8 does work well with this library along with the old ASUS TF300T tablet, Motorola Atrix 4G and various other old phones.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Not running on Nexus 7

I can confirm this library does not show the camera on a Nexus 7, even with latest library and manifest entries.

Running inside a panel would indeed be a better option so we could make a nice interface around it on for example a Nexus 7.

Cheers,
 

joneden

Active Member
Licensed User
Longtime User
Hi Bluedude, Icefairy doesn't seem to be supporting this lib. I'm hoping that within a few weeks to have a chance to look at doing it in a panel as you suggest.

My system would additionally need to store the image captured at the time of scanning. Currently I have to use the ABXZing lib to pass control to XZing then take the photo after control returns. Reworking this lib to do that in a panel would be very advantageous.
 

joneden

Active Member
Licensed User
Longtime User
Hi Icefairy,

My apologies - from reading through the posts you have been making updates to this - For some reason I had a period when I wasn't being notified of the forum posts.

Any chance of you posting the v1.5 source code so I can see if I can suss out the Nexus 7 issue?

Regards

Jon
 

joneden

Active Member
Licensed User
Longtime User
Hi icefairy

I've had a look at this and have found two lines that seem to cause the Nexus to not work.

In the CameraConfigurationManager class the lines that set the flash and zoom parameters are not supported on the nexus and end up killing the camera completely. Removing them makes the lib work although I don't know if they are used for anything on other units.

Tomorrow I'll be looking at getting some adjustments made to the scanning pane to make it more like the commercial version of ZXing. I'll also be looking at a way to either pass the camera image back to the user or save it to disk for later use.

If I post up any amends will you incorp them into your source code for anyone else to use?

Regards

Jon
 

bluedude

Well-Known Member
Licensed User
Longtime User
Joneden, running in a panel would be awesome. Also supporting front camera would be nice together with the panel.

That way you could actually create a nice article (EAN) scanning device for in stores etc.

Cheers,
 

joneden

Active Member
Licensed User
Longtime User
Yeah I saw icefairy's comment on that and knowing a lot less java than he does I think I have to agree. I don't doubt that it can be done but sadly not by me :(

The front camera issue with the Nexus is a very basic problem as the Nexus was just crashing because of the lines that I mentioned. I just commented them out in the java and all is now OK. I'm just working in increasing the scanning window size to be full width and 1/2 height which will match the commercial software. Then it's some testing.

Once I've finished I'll email icefairy with the changes so hopefully he (or she?) can include them in the proper release.

Cheers

Jon
 

icefairy333

Active Member
Licensed User
Longtime User
You should use "he".
sorry I'v no nexus device.
Yeah I saw icefairy's comment on that and knowing a lot less java than he does I think I have to agree. I don't doubt that it can be done but sadly not by me :(

The front camera issue with the Nexus is a very basic problem as the Nexus was just crashing because of the lines that I mentioned. I just commented them out in the java and all is now OK. I'm just working in increasing the scanning window size to be full width and 1/2 height which will match the commercial software. Then it's some testing.

Once I've finished I'll email icefairy with the changes so hopefully he (or she?) can include them in the proper release.

Cheers

Jon
 

yckhor

Member
Licensed User
Longtime User
Yeah I saw icefairy's comment on that and knowing a lot less java than he does I think I have to agree. I don't doubt that it can be done but sadly not by me :(

The front camera issue with the Nexus is a very basic problem as the Nexus was just crashing because of the lines that I mentioned. I just commented them out in the java and all is now OK. I'm just working in increasing the scanning window size to be full width and 1/2 height which will match the commercial software. Then it's some testing.

Once I've finished I'll email icefairy with the changes so hopefully he (or she?) can include them in the proper release.

Cheers

Jon
That would be awesome! Looking forward to have the scanning window in panel :)
 

Quillok

Member
Licensed User
Longtime User
Hey,
I'm using this great library too, but if I want to scan something on my tablet Acer Iconia A700, the screen stays black. The red line is visible, but it look as if it can't get an image from the camera. Other scanners are working. I wanted to use this library in my next app, but now I'm not sure on how many devices the scanner will work?!
Does anybody has some suggestions please? :/
 

Victor Pavlov

Member
Licensed User
Longtime User
Excellent work! One suggestion and some comments:
1. Create event/sub to capture "Back" button. Now it is difficult to do it.
2. It is important to keep track of latest version of ZXing library, in real job there are a lot of incorrect decodings.
 
Top