B4A Library QR Code Library

pic1.png


This library will create QR Codes (version 1 to 40), Aztec Codes (layer 1 to 11), PDF417, 2 of 5 Interleaved, EAN-13, EAN-8, Code 128, Code 39, Code 93, Code 11. Library files (*.xml and *.jar) inside the /Files folder. Copy them to your default library folder.

It will create *.PNG files that will be stored in the /pictures folder. From there you can load it into an image view or for eg mail it directly from there. You need to create a folder called pictures in the root folder of your device.

See attached sample project.

The code for this library has been posted in post #13 of this thread.

Go here https://www.b4x.com/android/forum/threads/qr-code-library.41408/#post-259448 for projects to create QR codes and scan some 1D and QR codes with. No internet connection required.

You can download and test any posting of mine in this thread but if you want to use it then you need to
 

Attachments

  • JHS BARCODES V102.zip
    146.9 KB · Views: 1,853
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
I tried several times to install your project, but newer had success; currently i use the files from 27. 5. and in my Libs section i see jhsbarcodes (version 1.01); but the zip file is named as version 1.02.
When i try to compile i get : Too many parameters.
Occured on line: 103
ver_num = QRcode.Draw_QR_Code
(message,err,mask_pattern, the background color, and the foreground/pixel color
Word: shape

Any idea what wrong?
Greetings form austria
Reinhard
 

rboeck

Well-Known Member
Licensed User
Longtime User
Hi Johan,

i use the jar file with the size 147.684 bytes and the xml file with 18.449 bytes. I dont no why, now i am one small step further. Your project compiles and installs, then it crashes.

The logfile is:

LogCat connected to: B4A-Bridge: Sony D5503-351680060225061
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (CallSubDelayed - HeartBeat)
sending message to waiting queue (CallSubDelayed - HeartBeat)
PackageAdded: package:JHSBarcodes.V1
azteccode_process_globals (java line: 2530)
java.lang.NoClassDefFoundError: adr.stringfunctions.stringfunctions
at JHSBarcodes.V1.azteccode._process_globals(azteccode.java:2530)
at JHSBarcodes.V1.main.initializeProcessGlobals(main.java:1021)
at JHSBarcodes.V1.main.afterFirstLayout(main.java:94)
at JHSBarcodes.V1.main.access$100(main.java:16)
at JHSBarcodes.V1.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5151)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Create, isFirst = false **
running waiting messages (2)
** Activity (main) Resume **
WakeLock already held.
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (CallSubDelayed - HeartBeat)
sending message to waiting queue (CallSubDelayed - HeartBeat)
sending message to waiting queue (CallSubDelayed - HeartBeat)
PackageAdded: package:JHSBarcodes.V1
Copying updated assets files (1)
java.lang.NoClassDefFoundError: adr.stringfunctions.stringfunctions
at JHSBarcodes.V1.azteccode._process_globals(azteccode.java:2530)
at JHSBarcodes.V1.main.initializeProcessGlobals(main.java:274)
at JHSBarcodes.V1.main.afterFirstLayout(main.java:94)
at JHSBarcodes.V1.main.access$100(main.java:16)
at JHSBarcodes.V1.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5151)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at dalvik.system.NativeStart.main(Native Method)
running waiting messages (3)
** Activity (main) Resume **

I tried it on two sony devices, android 4.4.2; i have no idea; i had problems of the same type with all versions. Now i tried it with an emulator and android 4.2. Here i get: Unfortunately, JHS BARCODES V1.01 has stopped.
 

rboeck

Well-Known Member
Licensed User
Longtime User
Yes, i have StringFunctions 1.00 checked; but it would compile without it to.
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
pic1.png


QRCPV3 and QRCPV4 - you can create and scan QR Codes with both these projects. The functionality wrt creating QR Code is the same. Different libraries used for scanning of codes in the two projects - scanning libraries as posted by @joneden and @vpires respectively.

Edit: For QRCPV4 - if you start the scanner you can turn on/off the torch by using the volume up/down buttons of your device.

Edit: OtherLibFiles.zip contains the library files (jar and xml) that are not in the /files folder of QRCPV4
 

Attachments

  • QRCPV4.zip
    260.6 KB · Views: 1,491
  • QRCPV3.zip
    503.1 KB · Views: 1,124
  • OtherLibFiles.zip
    461.1 KB · Views: 1,442
Last edited:

Reids

Member
Licensed User
Longtime User
I really waiting for THIS!! but
Still getting Zxing_scanner not found, please advice the correct link for Zxing_scanner library
 

Johan Schoeman

Expert
Licensed User
Longtime User
I really waiting for THIS!! but
Still getting Zxing_scanner not found, please advice the correct link for Zxing_scanner library
Check in the \files folder of the project. It should be there. Copy it to your additional libraries folder (zxing_scanner.jar and zxing_scanner.xml). Then refresh the libraries once you have started the project and select Zxing_scanner.
 

Reids

Member
Licensed User
Longtime User
Thank You Very Much it working now!! :D
this update really helpfull for me
 

Johan Schoeman

Expert
Licensed User
Longtime User
Here is a different version based on @icefairy333 's original posting. I have made amendments to @icefairy333 's original library (as posted in post #1 of his zxing thread)and recompiled it so that the torch can also be switched on/off via the volume up/down buttons. No other noise in this project. Just a simple button to start the scanner. Then you can control the torch with the volume buttons.

And here is a much improved version that gives you a whole lot of control over the general appearance of the scanner.
https://www.b4x.com/android/forum/t...airy333-and-modified-by-johan-schoeman.49084/
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
On request - attached the project with the code in the code modules that the library in post#1 of this thread was created from. You will need the following additional libraries (not added else project size will be too large to upload) to run the project:
Phone version 2.26
RSImageProcessing version 1.00
Reflection version 2.4
Stringfunctions version 1.05

Use/change/amend the code which ever way you like.
 

Attachments

  • JHS BARCODES B4Acode.zip
    97.2 KB · Views: 1,147

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Johan

Is there a way to specify the folder and the file name where the QRCode will be created?
That would be very helpful

Thank you
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan

Is there a way to specify the folder and the file name where the QRCode will be created?
That would be very helpful

Thank you
Not in the code that I have posted. It automatically saves it to the default pictures folder. Right at the end of each of the code modules is the code that does the saving. Search on the forum for how to save in a different folder and with a different filename and then amend the code accordingly. You can perhaps pass the file and folder names via variables to the different code modules when the DRAW___ methods are called. Should be easy to do.
 

tamayo461

Member
Licensed User
Longtime User
The project is very interesting, but I could not prove any of the sample applications, many problems with the required libraries.
 

Johan Schoeman

Expert
Licensed User
Longtime User
The project is very interesting, but I could not prove any of the sample applications, many problems with the required libraries.
You will have to give a lot more information in order for me to help you. What project are you referring to i.e post #???
What are the problems that you have?
What errors are you getting?
 

tamayo461

Member
Licensed User
Longtime User
I'm trying to test the app QR CPV4 downloaded from this post #8, the error I get is: "Error description: Declared QRcode is twice Either You should remove the reference library or the code module.."
thanks for answering..
 

Johan Schoeman

Expert
Licensed User
Longtime User
I'm trying to test the app QR CPV4 downloaded from this post #8, the error I get is: "Error description: Declared QRcode is twice Either You should remove the reference library or the code module.."
thanks for answering..
Seems like you might have the qrcode library enabled and there is a code module in the B4A project with the same name. Disable the library in the libs tab if that is the case. Can you upload a pic with the libraries that you have enabled in your project?
 

Derek Johnson

Active Member
Licensed User
Longtime User
View attachment 35705

QRCPV3 and QRCPV4 - you can create and scan QR Codes with both these projects. The functionality wrt creating QR Code is the same. Different libraries used for scanning of codes in the two projects - scanning libraries as posted by @joneden and @vpires respectively.

Edit: For QRCPV4 - if you start the scanner you can turn on/off the torch by using the volume up/down buttons of your device.

Edit: OtherLibFiles.zip contains the library files (jar and xml) that are not in the /files folder of QRCPV4

Just tried compiling this project and got this error:

B4A version: 6.30
Parsing code. (0.53s)
Compiling code. (1.37s)
Compiling layouts code. (0.07s)
Organizing libraries. (0.00s)
Generating R file. (1.20s)
Compiling debugger engine code. Error
B4A line: 4734
End Sub
javac 1.8.0_91
shell\src\QRCP\V4\qrcode_subs_0.java:4105: error: code too large for try statement
catch (Exception e) {
^
1 error

Could you tell me please, is this the wrong version of Java or something else going wrong?
 
Top