Android Question Problem with HTTPJOB Downloading multiple images

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello all,

I'm doing something wrong here, but really can't find out where... see:
- I created a service to download multiple images with a sub called downloadImage(dataMap As Map) like this:

B4X:
Sub downloadImage(dataMap As Map)

    Dim idRest As Long = dataMap.Get("idRest")
    Dim logoUrl As String = dataMap.Get("logoUrl")
    Dim mediaType As String = dataMap.Get("mediaType")

    Dim job as httpJob
    Dim json1 as jsonGenerator
    json1.initialize(dataMap)
    
    job.initialize(json1.tostring,Me)
    job.download(logoUrl)
    
    waitFor jobDone(job as httpJob)
    
    if job.success then   
        Dim json2 as jsonParser
        Dim mapRet as map
        json2.initialize(job.jobname)
        mapRet = json2.nextobject
        Dim mediaDownloaded as string = mapRet.get("logoUrl")
        ...
           'here doesn't care... record image and other processes running fine
        ...
    else
    
    end if
    job.release
    
end Sub

This routine is inside a service called downLoadImagesSevice ... there is no important code inside Start or Create subs
The problem: when I call 2 times or more the sub, it receives ONLY ONE callBack... it looks that HTTPJOB instances are being destroyed .

What am I doing wrong? Please help ! I really can't see the error.
 
Top