Hello,
I'm a very newbie about httputils, and have been reading two or more posibilities about how to download archives from a http web.
Now, at the moment, my prefered way (the simplest for me) is the next code. But, why doesn't download the two archives but only one??
Thanks for reading!
I'm a very newbie about httputils, and have been reading two or more posibilities about how to download archives from a http web.
Now, at the moment, my prefered way (the simplest for me) is the next code. But, why doesn't download the two archives but only one??
Thanks for reading!
B4X:
'Activity module
Sub Process_Globals
Dim image As Bitmap
End Sub
Sub Globals
Dim btnDownload As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
'check if we already loaded the image previously.
If image.IsInitialized Then
Activity.SetBackgroundImage(image)
End If
End Sub
Sub Activity_Resume
'check if download has finished while the activity was paused
If btnDownload.Enabled = False AND DownloadService.JobStatus = DownloadService.STATUS_DONE Then
FinishDownload
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnDownload_Click
Activity.Color = Colors.Black
DownloadService.URL = "http://www.b4x.com/basic4android/images/designer1.png"
DownloadService.Target = File.OpenOutput(File.DirRootExternal, "image.jpg", False)
StartService(DownloadService)
DownloadService.URL = "http://www........"
DownloadService.Target = File.OpenOutput(File.DirRootExternal, "text.txt", False)
StartService(DownloadService)
btnDownload.Enabled = False
End Sub
Sub FinishDownload
'Load the saved image
If DownloadService.DoneSuccessfully = True Then
'image = LoadBitmapSample(File.DirInternalCache, "image.png", _
' 100%x, 100%y)
'Activity.SetBackgroundImage(image)
End If
btnDownload.Enabled = True
DownloadService.JobStatus = DownloadService.STATUS_NONE
End Sub