Android Question CustomListView

Declan

Well-Known Member
Licensed User
Longtime User
I have been playing with the CustomListView.
I have a Panel that has 3 Labels, an image and a CheckBox.
When I click on the Panel, the CheckBox changes state.
This works cool.
I now need to be able to read lblDateTime.Text.
I have tried:
B4X:
Sub clv2_ItemClick(Index As Int, Value As Object)
    Log(Index & " = " & Value)
    Log("Panel Click: " & lblDateTime.Text)
   
    Dim pnl As Panel = clv2.GetPanel(Index)
    Dim chk As CheckBox = pnl.GetView(1)
   
    If Not(chk.Checked) Then
        chk.Checked = True
    Else
        chk.Checked = False
    End If
End Sub

Eish, but this don't work.
Could someone steer me in the right direction?
 

udg

Expert
Licensed User
Longtime User
Hi,
assuming that lblDateTime is one of the three labels on that same panel, you shoud do something like
B4X:
Dim lblDateTime as label = pnl.GetView(i)
where i is the relative position, counting from 0, of lblDateTime among the views on the panel. With position I mean the order following which the three labels, the image and the checkbox were added to the panel.
 
Upvote 0
Top