Type=Activity Version=5.8 ModulesStructureVersion=1 B4A=true @EndOfDesignText@ #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region 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 b,b1,b2 As ImageView Dim bt As Button Dim qr As QRCode Dim sc As Zxing_scanner Dim CODIGO As String Private Label1 As Label 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("qr") b.Initialize("") b1.Initialize("") b1.Gravity=Gravity.FILL b2.Initialize("") b2.Gravity=Gravity.FILL Activity.AddView(b,0,0,100dip,100dip) Activity.AddView(b1,0,110dip,300dip,100dip) Activity.AddView(b2,0,220dip,300dip,100dip) qr.initialize b.Bitmap = qr.QR_Encode("TESTING QR CODES",100dip) b1.Bitmap = qr.Ean13_Encode(calc_ean_checksum("123456789012"),100dip) ' Not interested in this b2.Bitmap = qr.Ean8_Encode(calc_ean_checksum("1234567"),100dip) ' Not interested in this bt.Initialize("bt") bt.Text="Codigo" Activity.AddView(bt,0,330dip,120dip,50dip) End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub bt_click 'ADDED BY JOHAN SCHOEMAN i.e OPTION TO CHANGE THE WIDTH AND HEIGHT OF THE VIEWING RECTANGLE Dim scan_width As Int Dim scan_height As Int scan_width = 400 scan_height = 400 sc.BeginScan("sc","CODIGO CLIENTE",scan_width,scan_height) End Sub Sub sc_result(atype As String,Values As String) 'Log("Type : " & atype) 'Log("Value : " & Values) CODIGO = Values b.Bitmap = qr.QR_Encode(Values,100dip) End Sub Sub sc_noScan Log("nothing returned from the scan !!!!!") End Sub Sub calc_ean_checksum(number As String) As String 'this has now become redundant as I am only interested in QR Codes Dim i As Int Dim c As Char Dim soma As Int Dim n As Int Dim digit As Float soma = 0 For i=0 To number.Length - 1 digit = number.SubString2(i,i+1) n= digit * ((i Mod 2) * 2 + 1) soma=soma+n Next Return number & ( ( 10 - ( soma Mod 10 )) Mod 10 ) End Sub