Now the downloading files from Internet is very simple due to Wait For.
But if at Activity opening a loop starts 50... 100 times downloading some _optional_ for user files to be listed, if he wants. Again - files are just for optional viewing...
Downloading can be rather long, if many files... and depends on the Internet speed...
But if the user decided to go BACK, closing the Activity - now it's impossible ! As Activity re-started again.
Boolean flag in the downloading sub does not help.
If 5-10 files to be downloaded - it's OK, downloadings are finished fast.
How to stop "waiting for" such lot of subs ?
B4X:
Sub DownloadImage(Link As String, iv As ImageView)
If InterruptDownloadingFlag Then Return 'stop, no more !
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Link)
Wait For (j) JobDone(j As HttpJob)
If InterruptDownloadingFlag Then Return 'stop !!!
If j.Success Then
iv.Bitmap = j.GetBitmap
End If
j.Release
End Sub
But if at Activity opening a loop starts 50... 100 times downloading some _optional_ for user files to be listed, if he wants. Again - files are just for optional viewing...
Downloading can be rather long, if many files... and depends on the Internet speed...
But if the user decided to go BACK, closing the Activity - now it's impossible ! As Activity re-started again.
Boolean flag in the downloading sub does not help.
If 5-10 files to be downloaded - it's OK, downloadings are finished fast.
How to stop "waiting for" such lot of subs ?
Last edited: