Android Example Create Personalised QR Codes

See attached project that you can use to make personalized QR codes with. Image that is superimposed over the QR code should preferably have a transparent background. You can do things like this:

pic2.png


All the additional library files that were used for this project are in the /files folder of the attached B4A project. The code module inside the B4A project has the code that creates the QR Codes. No internet connections are required to create the QR codes with.

Scan the above codes with something like NeoReader, i-nigma, or QRCPV4. It will take you to the applicable B4X websites.

Enjoy!
 

Attachments

Last edited:
Thanks for sharing it, I've been looking for code for creating QR all in B4A.
 
Search the forum for them. stringfunctions is part of B4A installation.
rsimage* is a Library. Search for it.
StringUtils is part of the B4A installation. StringFunctions is a library by @margret. Attached are the files....
 

Attachments

however, some features used by RSImageProcessing can also be obtained without using this library.

For example, resize the image:
Code: Copy
Sub CreateScaledBitmap(Original As Bitmap, NewWidth As Int, NewHeight As Int) As Bitmap
    Dim r As Reflector
    Dim b As Bitmap

    b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
        Array As Object(Original, NewWidth, NewHeight, true), _
        Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
    Return b
End Sub
 
Last edited:
The roundCorner could also be created.

A similar thing I got with the following code:

Code: Copy
Sub CreateBitmap As Canvas
   Dim bmp As Bitmap
   bmp.InitializeMutable(200dip, 200dip)
   Dim cvs As Canvas
   cvs.Initialize2(bmp)
   Dim r As Rect
   r.Initialize(0, 0, bmp.Width, bmp.Height)
   cvs.DrawRect(r, Colors.Transparent, True, 0)
   Dim p As Path
   p.Initialize(0, 0)
   Dim jo As JavaObject = p
   Dim x = 100dip, y = 100dip, radius = 100dip As Float
   jo.RunMethod("addCircle", Array As Object(x, y, radius, "CW"))
   cvs.ClipPath(p)
   Return cvs
End Sub

Sub DrawRoundBitmap (bmp As Bitmap) As Bitmap
   Dim r As Rect
   Dim cvs As Canvas = CreateBitmap
   
   r.Initialize(0, 0, cvs.Bitmap.Width, cvs.Bitmap.Height)
   cvs.DrawBitmap(bmp, Null, r)
   Return cvs.Bitmap
End Sub

But I'm not sure they do the same thing, it's true :p
 
Last edited:
Back
Top