Android Question Read text from customlistview

BreonB57

New Member
Hi there,

I am new to B4A so please bear with me. I have a customlistview which has items in it. I am trying to make it so that if a user clicks on an item, it will be able to retrieve all details about that item (The text and value). I have got the value, but I've got no idea about how to find the text. Please see my code below

B4X:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
    Dim search As String
    search = CustomListView1.GetValue
End Sub

Search is the text

Thanks
 

BreonB57

New Member
You must provide more information. What text? How are you adding items? We cannot guess those things.
Sorry, I am adding items like this
B4X:
CustomListView1.AddTextItem(text, value)
I am just trying to find a way to access the text value that is associated with the list items. The actual text that displays to the user. Please let me know if I need to provide more info

Thanks
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
This might help ..
B4X:
Sub CustomListView1_ItemClick(Index As Int, Value As Object) 
    Dim pnl As B4XView = CustomListView1.GetPanel(Index)
    dim myText as String = pnl.GetView(0).Text    'view(0) = 1st label on panel.. refer order in Designer ViewTree for Item/Row layout

This can vary depending on your CLV layout etc (are your row items views contained within a panel ?).. but should give you the idea.
 
Upvote 0
Top