B4J Question wait for download2 question

kohle

Active Member
Licensed User
Longtime User
Hi, the code is no running code, only show what I do and whats my problem.

I want to show a text like "End" at the end of a transfer with download2 and wait for

My first (1) transfer is in a loop and in this loop I open a sub with a second transfer (2).

What now happen is : 1 1 1 1 "End" 2 2 2 2 2 2 2 2 ...
It should be like this: 1 2 2 2 1 2 2 2 1 2 2 2 ..... END










B4X:
sub transfer

    Do While id < 5
        
        id = id + 1
        
        
        'Start download2 with parmeters'
        
        Dim j As HttpJob
        j.download2(url_a, para)
  
        Wait For (j) JobDone(j As HttpJob)
        If j.Success Then
            txtInfo.Text=txtInfo.Text & j.GetString & CRLF
            Log(j.GetString)
            
            SendMessage_Stunde(id)     'Sending sub data stuff'
            
        End If
        j.Release
    Loop
    
    txtinfo.text = "End"
    
end sub
    
sub SendMessage_Stunde(id as long )     
    dim i as int
    
    for i=1 to 3
        Dim j As HttpJob
        j.download2(url_a, para)
  
        Wait For (j) JobDone(j As HttpJob)
        If j.Success Then
            txtInfo.Text=txtInfo.Text & j.GetString & CRLF
            Log(j.GetString)
        end if   
    next


end sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top