Sub Activity_Resume
For i = 0 To 4
Dim contentstr As String = "000201" & i
Dim backgrbmp As Bitmap = bm
Dim logobmp As Bitmap = bm1
Dim qrcode As AwesomeQRCode_1 = create_qrcode(contentstr,backgrbmp,logobmp)
Dim pnl As Panel = set_clv_item(qrcode,150dip,150dip)
clv.Add(pnl,contentstr)
Next
Activity.RemoveAllViews
Activity.AddView(clv.AsView,0dip,0dip,clv.AsView.Width,clv.AsView.Height)
End Sub
Sub set_clv_item(qrc As AwesomeQRCode_1,ivwidth As Int, ivheight As Int) As Panel
Dim pnl As Panel
pnl.Initialize("")
pnl.SetLayout(0dip,0dip,ivwidth,ivheight)
Dim iv As ImageView
iv.Initialize("")
iv.SetLayout(0dip,0dip,ivwidth,ivheight)
iv.Gravity = Gravity.FILL
iv.Bitmap = qrc.render
pnl.AddView(iv,0dip,0dip,ivwidth,ivheight)
Return pnl
End Sub
Sub create_qrcode(contentstring As String,backgroundbitmap As Bitmap,logobitmap As Bitmap) As AwesomeQRCode_1
Dim aqrc As AwesomeQRCode_1
aqrc.Initialize("")
aqrc.autoColor(True)
aqrc.contents(contentstring)
aqrc.background(backgroundbitmap)
aqrc.dotScale(0.8)
aqrc.logoScale(0.35)
aqrc.logoMargin(20)
aqrc.logoRadius(10)
aqrc.logo(logobitmap) 'ไม่ใส่ logo ต้องการรูป Backgroud เท่านั้น
aqrc.binarizeThreshold(128)
aqrc.binarize(False)
aqrc.colorDark(Colors.Black)
aqrc.colorLight(Colors.White)
aqrc.margin(30)
aqrc.roundedDots(True)
aqrc.whiteMargin(True)
Return aqrc
End Sub
Private Sub clv_ItemClick (Index As Int, Value As Object)
Log(Value) ' content from qr-code
End Sub