Android Question Get second line listview value

select

Member
Licensed User
Longtime User
Hello! There is a way to get the value of the second line of a clicked item in a listview?

For the first line is simple, like:

B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
MyVal = Value
End Sub

How can I do this for the second line?

tnx!
 

DonManfred

Expert
Licensed User
Longtime User
Store all informations in one object. For example a map

B4X:
        Dim retmap As Map
        retmap.Initialize
        retmap.Put("tag","mytag")
        retmap.Put("itemID","0815")
        retmap.Put("name","Test")
        retmap.Put("line1","Line 1")
        retmap.Put("line2","Line 2")
        lv.AddTwoLines2(retmap.Get("line1"),retmap.Get("line2"), retmap)
End Sub
Sub lv_ItemClick (Position As Int, Value As Object)
    Dim retmap As Map = Value
    Log("Item at Pos "&Position&" Clicked...")
    Log("ItemInfos:")
    Log("tag = "&retmap.Get("tag"))
    Log("itemID = "&retmap.Get("itemID"))
    Log("name = "&retmap.Get("name"))
    Log("line 1 = "&retmap.Get("line1"))
    Log("line 2 = "&retmap.Get("line2"))
End Sub
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
@DonManfred:
Why can't he use something simple like this or did I totally misunderstand his question? But again, who am I to argue with the powerhouse Manfred.
B4X:
Listview1.AddTwoLines2("line1text","line2text","line2text")

Sub Listview1_ItemClick (Position As Int, Value As Object)
    Dim MyVal As String = Value
    Log(MyVal)  'displays: line2text
End Sub
 
Upvote 0
Top