Android Question Multiple values in custom list view

frenkipi

Member
Licensed User
Longtime User
Hello, I am trying to add another Value in my custom list view.

B4X:
clv2.Add(CreateListItem($"Item #${i}"$, clv2.AsView.Width, 70dip), 70dip, $"Item #${i}"$, "another value"&i)

I was trying with modifying customListView class.... and I get an error:

I have uploaded an example project.


Thank you for your help!
 

Attachments

  • CustomListView.zip
    61.5 KB · Views: 156

mangojack

Expert
Licensed User
Longtime User
Use a map to store as many 'values' as you want for each row item ...

B4X:
For i = 1 To 5
   Dim myMap As Map
   myMap.Initialize
   myMap.Put("value1",  $"First value for Item #${i}"$)
   myMap.Put("value2",  $"Second value for Item #${i}"$)
  'myMap.Put (......................
   clv1.Add(CreateListItem($"Item #${i}"$, clv1.AsView.Width, 70dip), 70dip, myMap)
Next

Sub clv1_ItemClick (Index As Int, Value As Object)

    Dim m As Map = Value
    Log(m.Get("value1"))
    Log(m.Get("value2"))

End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…