Android Question B4A Searchtemplate add Tag for each item in CLV

Hi for all, i need a bit help with this plz.

Im using this code and works fine, but i need some more.
this code:
            Base = Activity
            Dialog.Initialize (Base)
            SearchTemplate.Initialize
            
            Dim Items As List
            Items.Initialize
            Wait For ( Families(pnl1.Tag, Items) ) Complete (ResultF As Boolean)
            SearchTemplate.SetItems(Items)
            SearchTemplate.Resize(90%x, 90%y)
            
            Dim rs As ResumableSub = Dialog.ShowTemplate(SearchTemplate, "", "", "CANCEL")
            Dim cancelbtn As B4XView = Dialog.GetButton(xui.DialogResponse_Cancel)
            
            cancelbtn.Width = 120dip
            cancelbtn.Left = cancelbtn.Left - 50dip
            
            Wait For ( rs ) Complete (Result As Int)
            If Result = xui.DialogResponse_Positive Then
                log(SearchTemplate.SelectedItem)

In the last line (the log) i get the text of the item clicked.
I need asign a tag in each item and when clicked i need read the tag.

I hope any can help me.
Thanks
 
Thx Erel for the answer. Just only a few questions.

is possible modify the searchtemplate to add the tag?
if i use Maps is better use something like KeyValueStore?
if i need store 2 lines with the same key but different values, how i need to do that?

Thanks.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Yes i can have the same key with different values. I think I'm making it more difficult than it is. I can solve it in another way. With the map you helped me.
Thank you very much Erel.
 
Upvote 0
Top