Android Question How to use two requests with HttpJob

bollanog

Member
Hello good afternoon everyone, I have a hard time using HttpJob, I have a project and which one I am using.

B4X:
Sub Process_Globals
    Dim http As HttpJob
    
    Dim URL As String = "https://url.com/v1"
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Main")

    http.Initialize("http", Me)
    http.Download(URL)
End Sub

Sub httpDone (Job As HttpJob)
    ProgressDialogHide
    If Job.Success = True Then
        Try
            'DEFINIR VARIABLES JSON
            Dim JSON As JSONParser
            
            JSON.Initialize(Job.GetString)
            
            CargarEstadisticas(JSON.NextObject, 1)
            
        Catch
            Actualizar("Error al obtener los datos",2, "Intentar de nuevo","Salir")
        End Try
    Else
        Actualizar("Error al conectar con el servidor",2, "Intentar de nuevo","Salir")
    End If
End Sub

Which works for me wonderfully, the question is. How can you use two http.Download (URL) and http.Download (URL2) at the same time, make two queries of two urls at the same time and how can I get the answer from the second url? Which I only get one, I await your opinions and responses.
 
Top