iOS Question Problem with list

mrossen

Active Member
Licensed User
Hi,

I have a dataset I get from a mysql database.

If I get the data right I store the record in a txt file with file.writelist
If I dont have data connection I read the dataset with file.readlist, but something seems not to be done right.

I hope someone can see what I have made right

I get no error but the app craches.

B4X:
Sub JobDone(Job As HttpJob)
   
    Dim oldData, newData As String
    Dim partNoAll As String
       
    brand_cars.Initialize
       
    Dim lType As List
   
    lType.Initialize
   
   
   
    ListViewCars.TwoLinesLayout.Label.Textsize = 16
    ListViewCars.TwoLinesLayout.SecondLabel.Textsize = 14
   
       
    ProgressDialogHide
    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
                    mAll = brand_list.Get(i)
                    partNoAll = mAll.Get("partno")

                    newData = mAll.Get("brand") & " - " & mAll.Get("model") & " - " & mAll.Get("engine") & " - " & mAll.Get("yearfrom") & " - " & mAll.Get("fuel") & " - " & mAll.Get("variant") & " - " & partNoAll.CharAt(5)
                                       
                    If newData <> oldData Then
                        brand_cars.Add(brand_list.Get(i))
                    End If
                       
                    oldData = mAll.Get("brand") & " - " & mAll.Get("model") & " - " & mAll.Get("engine") & " - " & mAll.Get("yearfrom") & " - " & mAll.Get("fuel") & " - " & mAll.Get("variant")  & " - " & partNoAll.CharAt(5)
                   
                Next
           
                File.WriteList(File.DirRootExternal, "ListBrand.txt", brand_cars)
               
                getCars
               
        End Select
    Else
        ToastMessageShow("No internet connection", True)
       

        brand_cars = File.ReadList(File.DirRootExternal, "ListBrand.txt")
        getCars
       
       
    End If
    Job.Release

                   
                   
End Sub
 
Top