Android Question Listview

Lars Andersson

Member
Licensed User
Longtime User
Is it possible to set or get the "SecondLabel" on a item in a listview at runtime?
Also, how do a add a tag to every item?

Lars
 

mangojack

Well-Known Member
Licensed User
Longtime User
You can use .AddTwoLines2 to specify a return value for the list click event ..
B4X:
 Dim  label1,label2,l As String
 label1 = "abc"
 label2 = "def"
   'using .AddTwoLines2..  allows return value to be specified for click events...
   ListView1.AddTwoLines2(label1,label2,label2)   '...Last parameter is return value

Cheers mj
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Both is simply possible. You can store with easy Listview-Item a "ReturnValue". Use this Returnvalue using a map.

Here is a short example which uses this Feature.

B4X:
For i = 0 To 9
  Dim retmap As Map
  retmap.Initialize
  retmap.Put("tag","TagValue"&i)
  retmap.Put("itemID","ItemID"&i)
  retmap.Put("name","ItemName"&i)
  retmap.Put("line1","This is line 1")
  retmap.Put("line2","This is line 2")
  lv.AddTwoLines2(retmap.Get("line1"), retmap.Get("line2"), retmap)
Next

"retmap" in this case could be a complete Databaseentry with all Informations about an article for example...

If my answer helps please click on "Like"
 

Attachments

  • listviewtest.zip
    7 KB · Views: 412
Upvote 0
Top