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

  • PersonalisedQRcodes.zip
    486.1 KB · Views: 1,334
Last edited:

Star-Dust

Expert
Licensed User
Thanks for sharing it, I've been looking for code for creating QR all in B4A.
 

Johan Schoeman

Expert
Licensed User
Longtime User
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

  • stringfunctions.jar
    6.9 KB · Views: 359
  • stringfunctions.xml
    22.3 KB · Views: 481
  • rsimageprocessing.xml
    52.2 KB · Views: 498
  • rsimageprocessing.jar
    387.8 KB · Views: 394

Star-Dust

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

For example, resize the image:
B4X:
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:

Star-Dust

Expert
Licensed User
The roundCorner could also be created.

A similar thing I got with the following code:

B4X:
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:

Johan Schoeman

Expert
Licensed User
Longtime User
Top