Android Question CustomListView

theladygeneral

Member
Licensed User
Longtime User
Hello
I have a question, please dont send me to a tutorial, been there done that.
I used designer for layout
all on one layout
clv1 customlistview
edtin edittext
bntin button
lblout label

i use AddTextItem to populate clv1

my question is how to get text values out of clv1

for example click on item in clv1 and populate lblout

thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I assume that you are using xCustomListView.

Option 1: Set the value parameter in AddTextItem to be the same as the text parameter.
And then:
B4X:
Sub CLV_ItemClick (Index As Int, Value As Object)
 lbl1.Text = Value
End Sub

Option 2:
B4X:
Sub CLV_ItemClick (Index As Int, Value As Object)
 lbl1.Text = clv1.GetPanel(Index).GetView(0).Text 'the label is the first (and only) view in the item's panel.
End Sub
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Change this Sub .. you were passing the EditText object as value
B4X:
Sub bntin_Click
    clv1.AddTextItem(edtin.Text, edtin.Text)  'pass the text property of the EditText ...
    edtin.Text=""  
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…