Android Question Job done Async

Discussion in 'Android Questions' started by victormedranop, Aug 20, 2017.

  1. victormedranop

    victormedranop Well-Known Member Licensed User

    Hi I need to accelerate fills data on a list view.
    because its to slow downloading and have to wait to complete de download to start working with it.
    listview it's slow.

    I should try ultimate listview


    I have this
    Code:
    job1.Download("http://ibsj.org/app/index.php")
    Sub JobDone (Job As HttpJob)
      
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
      
    If Job.Success = True Then
      
    Select Job.JobName
      
    Case "Job1"
       
    Log("JOB 1")
       
    Dim parser As JSONParser
     parser.Initialize(Job.GetString)
     
    Dim root As List = parser.NextArray
     
    For Each colroot As Map In root  
     
    'Dim date As String = colroot.Get("date")
     Dim thumb_url As String = colroot.Get("thumb_url")
     
    Dim video_url As String = colroot.Get("video_url")  
     
    Dim author As String = colroot.Get("author")   
     
    Dim audio_url As String = colroot.Get("audio_url")
     
    Dim title As String = colroot.Get("title")   
     display_data(title,author,trim_string2(RemoveAccents(thumb_url)),audio_url,video_url)
     ListView1.Invalidate  
     
    Next
      
    End Select
      
    Else
      
    Log("Error: " & Job.ErrorMessage)
      
    ToastMessageShow("Error: " & Job.ErrorMessage, True)
      
    Return
      
    End If
      Job.Release
      job_complete = 
    1
      WebView1.Visible = 
    False
    End Sub

    Sub display_data (data1 As String, data2 As String, data3 As String ,data4 As String, data5 As String )
     
    If data3.Length = 0 Then
     ListView1.AddTwoLinesAndBitmap( trim_string(data1) , data2,
    LoadBitmapSample(File.DirAssets,"play2.png",15dip,15dip)) 
     
    Else
     ListView1.AddTwoLinesAndBitmap( trim_string(data1) , data2,
    LoadBitmapSample(File.DirAssets,data3,15dip,15dip)) 
     ListView1.Invalidate  
     
    End If
     
    'DoEvents
     Sleep(1000)
     List1.Add(data1)
     List2.Add(data2)
     List3.Add(data3)
     List4.Add(data4)
     List5.Add(data5)
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

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