Problem with HTTPUtils2

KZero

Active Member
Licensed User
Longtime User
Hi,

i'm using httpUtils2 to download some pics in the Main Activity

but if i started other activity before all jobs (in the Main Activity) complete every jobdone execute start the main activity again !


the problem reason is that httputils2 using service and always active while downloading
and once the download finish it call the main activity (job_done)
that make main activity start if its paused

any idea to fix it ? :confused:
 

KZero

Active Member
Licensed User
Longtime User
This is how CallSubDelayed works. It starts the activity if it paused (unless the complete app is in the background).

I guess that in your case it would be better to handle the downloads from a service instead of the main activity.

exactly
but i can't handle the job_done from service cuz its not possible to call "main.imageview.bitmap" from other activity or service !

there is anyway to pause the download then resume it when the activity is not paused ?

:sign0085:
 
Upvote 0

KZero

Active Member
Licensed User
Longtime User
You should handle JobDone in the service and store the bitmap as a process global variable.

Check if the main activity is running:
B4X:
If IsPaused(Main) = False Then
 CallSubDelayed2(Main, "SetBitmap", bmp)
End If
In Main's Activity_Resume you should check if MyNewService.bmp.IsInitialized and set it.

acceptable idea :) thx
 
Upvote 0
Top