Hi all
I'm using this code to download a number of images in a list, one by one:
The problem is that if the user presses the back button, the application will return again to complete the download
How can I cancel this downloads?
Thanks
I'm using this code to download a number of images in a list, one by one:
B4X:
' img is an array of ImageViews, ImageView.tag is the url of the image
Do While i<=(img.Length-1)
Dim j As HttpJob
j.Initialize("", Me)
j.Download(img(i).tag)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirInternal, i & ".jpg", False)
File.Copy2(j.GetInputStream, out)
out.Close
Dim bm As Bitmap
bm.Initialize(File.DirInternal, i & ".jpg")
i=i+1
End If
Loop
The problem is that if the user presses the back button, the application will return again to complete the download
How can I cancel this downloads?
Thanks