Android Question add new data to existing data array in list

Discussion in 'Android Questions' started by mrossen, Feb 23, 2015.

  1. mrossen

    mrossen Active Member Licensed User

    Hi,

    I have a multicolum dataset I read into at list.

    I dont use all the records in listview, there fore I have the problem finding it again.
    The listview position is not the same as in the list.

    My plan was to add the position of the listview to the existing list.

    But it har to be done at the end of the recordline.

    How can I do that?

    Code:
    If Job.Success Then
        
    Dim res As String
            res = Job.GetString
       
            
    Dim parser As JSONParser
            parser.Initialize(res)
            
    Select Job.JobName
                
    Case brand
               
                    brand_list = parser.NextArray 
    'returns a list with maps
                   
                    
    For i = 0 To brand_list.Size - 1
                        m = brand_list.Get(i)
                       
                        tl.First = m.Get(
    "brand") & " "  & m.Get("model") & " / " & m.Get("engine") & " / " & m.Get("yearfrom")
                        tl.Second = m.Get(
    "fuel")  & " - " & m.Get("variant") & " - " & m.Get("comments")
                       
                        newData = m.Get(
    "brand") & " - " & m.Get("model") & " - " & m.Get("engine") & " - " & m.Get("yearfrom") & " - " & m.Get("fuel") & " - " & m.Get("variant")
                       
                        
    If newData <> oldData Then
                            ListViewCars.AddTwoLines2(tl.First, tl.Second, tl)
                            brand_list.
                        
    End If
                           
                        oldData = m.Get(
    "brand") & " - " & m.Get("model") & " - " & m.Get("engine") & " - " & m.Get("yearfrom") & " - " & m.Get("fuel") & " - " & m.Get("variant")
                       
                    
    Next
                   
                   
            
    End Select
        
    Else
            
    ToastMessageShow("Error: " & Job.ErrorMessage, True)
        
    End If
        Job.Release
     
  2. DonManfred

    DonManfred Expert Licensed User

    Use a global list to hold the actual contents of brands
    When filling the listview: clear global list on start. For each item you add to the listview you add the corresponsing map to the global list.
    Code:
    For i = 0 To brand_list.Size - 1
      
    dim m as Map = brand_list.Get(i)
    and then add "m" to the globallist

    Now it should be easier to find the right id and in addition you have found the hole map for this entry.
     
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