Android Question Customlistview Itemclick


Licensed User
Longtime User
I'm probably losing myself in a glass of water.
Using customlistview to show a list of texts, each panel added to the customlistview therefore has a text field.
For each panel I have associated a unique code that allows you to select the record associated with the text and then perform operations on it.
ItemClick associated with the customview is not activated because the panel is completely "covered" by the edittext field.
So I can't capture the itemclick event on customlistview.
Is there a javascript-type "click through" mechanism to "activate" the custom list view item?

Sub b_4_click

    s_panel_message.AddView(s_panel_message_sal.AsView,  0,0,100%x, 100%y)
    Dim Cursor1 As Cursor
    Dim p_tmp As Panel
    Dim stmp As String
    Cursor1 = SQL.ExecQuery("select rowid, * from na_msgoff ")
    For i = 0 To Cursor1.RowCount - 1
        Cursor1.Position = i
        stmp = Cursor1.GetString("mo_msg")
        p_tmp = addmessage(stmp)
        s_panel_message_sal.Add(p_tmp, p_tmp.height, Cursor1.GetString("rowid"))
    p_tmp = s_panel_message_empty
    s_panel_message_sal.Add(p_tmp, p_tmp.height, "")
End Sub

Sub addmessage(vmsg As String) As Panel

    Dim p_tmp As Panel
    Dim str1 As EditText
    p_tmp.Color =  Colors.RGB(235, 151, 15)
    str1.Color = Colors.Red
    str1.TextColor = Colors.White
    str1.Gravity = Gravity.TOP + Gravity.LEFT
    str1.width = objwidth
    str1.Height = 150dip
    str1.text = vmsg
    str1.Enabled = False
    p_tmp.AddView(str1,leftstart,10dip,t_1.width, t_1.Height)
    p_tmp.height = str1.Height + lspace
    Return p_tmp
End Sub

Sub s_panel_message_sal_ItemClick (Index As Int, Value As Object)
End Sub


Well-Known Member
Licensed User
Longtime User
One option ... add another transparent panel covering the edit text to handle the click event.
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
The EditText will catch the touch events. Why are you using an EditText instead of Label? Is the user expected to edit the text?

Maybe put a button or CheckBox on the left side instead of handling the ItemClick event.

BTW, it is a mistake to create the layout programmatically. It will be easier to do it with the designer. Especially when it becomes more complicated.
Upvote 0


Licensed User
Longtime User
Thank you.
Yes, after the selection the user can modify the text (after having recovered some information from the DB).
I tried to capture the click on the edittext, but the subroutine str1_click is not activated, also since they are all equal fields I don't know how to distinguish them, that is how to recover the id of access to the DB.
If I put a button or a checkbox anyway I have to distinguish each single edittext and have the click subroutine for each edittext.
Upvote 0