On a CustomView, this is the code for creating a new list item:
And to insert it, I use this:
Using this, is there a way to determine how many checkboxes are selected within the list?
B4X:
Sub CreateListItem(Text As String, Text2 As String, Width As Int, Height As Int, Image As Bitmap) As Panel
Dim p As Panel
Dim chk As CheckBox
p.Initialize("")
p.Color = Colors.Black
Dim img1 As ImageView
img1.Initialize("img1")
img1.Gravity = Gravity.FILL
img1.Bitmap = Image
chk.Initialize("chk")
title.Initialize("")
title.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
title.Text = Text
title.TextSize = 16
title.TextColor = Colors.White
Dim subtitle As Label
subtitle.Initialize("")
subtitle.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.BOTTOM)
subtitle.Text = Text2
subtitle.TextSize = 14
subtitle.TextColor = Colors.White
p.AddView(img1, 2dip, 2dip, 50dip, Height - 4dip) 'view #0
p.AddView(title, 65dip, -7dip, 300dip, Height - 4dip) 'view #1
p.AddView(subtitle, 66dip, -2dip, 300dip, Height - 4dip) 'view #1
p.AddView(chk, 88%x, 2dip, 50dip, Height - 4dip) 'view #2
Return p
End Sub
And to insert it, I use this:
B4X:
CustView.Add(CreateListItem("Title","Subtitle", CustView.AsView.Width, 50dip, LoadBitmap(File.DirAssets, "image.png")), 50dip, "")
Using this, is there a way to determine how many checkboxes are selected within the list?