Android Question Get second line listview value

Discussion in 'Android Questions' started by select, Jun 12, 2015.

  1. select

    select Member Licensed 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:

    Code:
    Sub ListView1_ItemClick (Position As Int, Value As Object)
    MyVal = Value
    End Sub
    How can I do this for the second line?

    tnx!
     
  2. DonManfred

    DonManfred Expert Licensed User

    Store all informations in one object. For example a map

    Code:
    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
     
    giga and lemonisdead like this.
  3. Mahares

    Mahares Well-Known Member Licensed 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.
    Code:
    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
     
    mangojack likes this.
  4. DonManfred

    DonManfred Expert Licensed User

    Sure you can just use a string
    But i find it more confortable to store more info
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice