توی متد OnPostExecute مقدار هاتون رو که گرفتین ، ادپتر رو initialize کنین و مقدار ها رو بهش بدین
سلام کد ها رو تست نکردم اگه احیانا موردی داشت اصلاح کنید
بدون حلقه :
Sub task_DoInBackground(Params() As Object) As Object
Dim f1,f2,f3,f4 As AriaFile
f1.initialize(File.DirInternal,"File1.jpg")
downloader.Get("Address1").File(f1)
task.PublishProgress(1)
f2.initialize(File.DirInternal,"File2.jpg")
downloader.Get("Address2").File(f2)
task.PublishProgress(2)
f3.initialize(File.DirInternal,"File3.jpg")
downloader.Get("Address3").File(f3)
task.PublishProgress(3)
f4.initialize(File.DirInternal,"File4.jpg")
downloader.Get("Address4").File(f4)
task.PublishProgress(4)
Return "Downloads Done"
End Sub
Sub task_OnProgressUpdate(Progress As Int)
ToastMessageShow("File "& Progress &" Downloaded.",False)
End Sub
Sub task_OnPostExecute(Result As Object)
ToastMessageShow(Result,True)
End Sub
با حلقه :
Sub Activity_Create(FirstTime As Boolean)
task.Run(Array("Addres1","Addres2","Addres3","Addres4")) 'har tedad address bedin download mikone'
End Sub
Sub task_DoInBackground(Params() As Object) As Object
For i=0 To Params.Length-1
Dim AFile As AriaFile
AFile.initialize(File.DirInternal,"F"&i&".jpg")
downloader.Get(Params(i)).File(AFile)
task.PublishProgress(i+1)
Next
Return "Downloads Done"
End Sub
Sub task_OnProgressUpdate(Progress As Int)
ToastMessageShow("File "& Progress &" Downloaded.",False)
End Sub
Sub task_OnPostExecute(Result As Object)
ToastMessageShow(Result,True)
End Sub