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:

DonManfred

Expert
Licensed User
Longtime User
Could you tell me please, is this the wrong version of Java or something else going wrong?
Based on the error you got your try-catch-block is too big
shell\src\QRCP\V4\qrcode_subs_0.java:4105: error: code too large for try statement

Use smaller try-catch-blocks
 

Boen TP

New Member
Licensed User
Hi Everyone,
I am not sure whether I am posting to the right thread, but it seems that I can't find any thread mentioning QRCode in B4i forums.
Are there any libraries similar to this one for B4i ?

Thanks.
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Johan,

B4X:
 QRcode.Draw_QR_Code(StringToDisplay,err,mask_pattern,back_color,fore_color,shape)

The above code generates an exception for Android 8+ unless, unless we ask for permission for write to external storage.
Is there a way to use the above code with: GetSafeDirDefaultExternal

Thanks
iCAB
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User

Johan Schoeman

Expert
Licensed User
Longtime User

 

carlos7000

Well-Known Member
Licensed User
Longtime User
Hi Johan Shoeman

I already tried both suggestions.

The first suggestion works, but if the data is more than 78 bytes long, it fails.

B4X:
    Dim Bytes() As Byte = Text.GetBytes("utf8") 'non-standard but still recommended
    If Bytes.Length > 78 Then
        Log("Too long!")
        Return Null
    End If

the second option has not worked for me. install all the libraries, I move one or another thing. it just gives me errors. every time the compiler always says something is missing. I am looking for something simple as the first suggestion.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan Shoeman

I already tried both suggestions.

The first suggestion works, but if the data is more than 78 bytes long, it fails.

B4X:
    Dim Bytes() As Byte = Text.GetBytes("utf8") 'non-standard but still recommended
    If Bytes.Length > 78 Then
        Log("Too long!")
        Return Null
    End If

the second option has not worked for me. install all the libraries, I move one or another thing. it just gives me errors. every time the compiler always says something is missing. I am looking for something simple as the first suggestion.
What is the error that you get with option 2? Can you post the error?
 

carlos7000

Well-Known Member
Licensed User
Longtime User
What is the error that you get with option 2? Can you post the error?

Download the project again, I compiled it, and only a couple of little bugs appeared.

Change the targetSdkVersion to 28, and delete the line:

B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")

Compiled well.

I'm going to see if I can integrate the qrcode in my application.

Thanks
 
Top