Android Question xCustomlistview Library and Button Click

Discussion in 'Android Questions' started by Cornelius Smit, Oct 3, 2018.

  1. Cornelius Smit

    Cornelius Smit Member Licensed User

    Good day
    I need help please I have a custom listview (library) and use a layout for my image and a button !! How do i capture the correct button click event
    Thank you in advance
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Hello @Cornelius Smit, welcome to this great community.
    Everything that you need to know can be fund in the first post right HERE, just download the code and study it carefully, it really is straight forward to follow.

    Wait a minute, have you looked at this sub in the example provided?

    I've added a log line in the code below, it will help you out a bit to see what is happening when you click a button in Erel's example.
    Sub Button1_Click
    Dim index As Int = clv2.GetItemFromView(Sender)
    Dim pnl As B4XView = clv2.GetPanel(index)
    Dim lbl As B4XView = pnl.GetView(0)
    Dim chk As B4XView = pnl.GetView(2)
        lbl.Text = 
    'Msgbox("Item value: " & clv2.GetValue(index) & CRLF & "Check value: " & chk.Checked, "")

    Dim chk1 As B4XView = pnl.GetView(2)
    Log("Checked = " & chk1.Checked)

    Dim checkedItems As List
    For i = 0 To clv2.GetSize - 1
    Dim p As B4XView = clv2.GetPanel(i)
    Dim chk As B4XView = p.GetView(2)
    If chk.Checked Then
    End If
    Log("Checked items: " & checkedItems)
    End Sub
    Last edited: Oct 3, 2018
    Cornelius Smit likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice