Android Question MultiThread

kkkpe

Active Member
Licensed User
Longtime User
I have to load with httputils2 a spinner with many data records. how can I run a multithreaded? Can I use the library Treading? there is a better solution for multi-threaded?
 

kkkpe

Active Member
Licensed User
Longtime User
B4X:
Sub JobDone(risp As HttpJob)
    If risp.Success Then
        Dim dati As String
        Dim jsondati As JSONParser
        Dim listadati As List
        Dim m As Map
       
        If(risp.JobName="ricevidati") Then
            dati=risp.GetString
            jsondati.Initialize(dati)
            listadati=jsondati.NextArray
            'Spinner1.Add("")
            ACSpinner1.Add("")
            For i=0 To listadati.Size-1
                m=listadati.Get(i)
                'Spinner1.Add(m.Get("descrizione"))
                ACSpinner1.Add(m.Get("descrizione"))
                mdati.Put(m.Get("descrizione"),m.Get("codice"))
            Next
        else If(risp.JobName="inviocoord")Then   
            Try
                dati=risp.GetString
                jsondati.Initialize(dati)
                m=jsondati.NextObject
                If(m.Get("risposta")="ok")Then
                    Msgbox("COORDINATE REGISTRATE","MESSAGGIO")
                End If       
            Catch
                Msgbox(LastException,"MESSAGGIO")
            End Try
           
        End If
    End If
    risp.Release
End Sub
 
Upvote 0

kkkpe

Active Member
Licensed User
Longtime User
Thanks Erel have answered you directly. For me this is an honor.
I'll do the tests and let you know.
I would like to ask you how I can manage the multithread with B4A.
 
Upvote 0
Top