چطوری می توانم میزان پیشرفت دانلود را در progressbar نمايش بدهم؟
اینم سورس برنامه
Sub Globals
Dim ht As HttpJob
Private EditText1 As EditText
Private btndankardan As Button
Private ProgressBar1 As ProgressBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btndownload_Click
ht.Initialize("ht",Me)
ht.Download(EditText1.Text)
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = True Then
If File.IsDirectory(File.DirRootExternal,"download") = False Then
File.MakeDir(File.DirRootExternal,"download")
End If
Dim g1 As InputStream
Dim f1 As OutputStream
g1 = Job.GetInputStream
f1 = File.OpenOutput(File.DirRootExternal & "/download","download.rar",False)
File.Copy2(g1,f1)
g1.Close
f1.Close
ToastMessageShow("دانلود شد",False)
Else
ToastMessageShow("دانلود نشد",False)
End If
End Sub
سوال
ebraeim 8
سلام
چطوری می توانم میزان پیشرفت دانلود را در progressbar نمايش بدهم؟
اینم سورس برنامه
Sub Globals Dim ht As HttpJob Private EditText1 As EditText Private btndankardan As Button Private ProgressBar1 As ProgressBar End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("Layout1") End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub btndownload_Click ht.Initialize("ht",Me) ht.Download(EditText1.Text) End Sub Sub JobDone(Job As HttpJob) If Job.Success = True Then If File.IsDirectory(File.DirRootExternal,"download") = False Then File.MakeDir(File.DirRootExternal,"download") End If Dim g1 As InputStream Dim f1 As OutputStream g1 = Job.GetInputStream f1 = File.OpenOutput(File.DirRootExternal & "/download","download.rar",False) File.Copy2(g1,f1) g1.Close f1.Close ToastMessageShow("دانلود شد",False) Else ToastMessageShow("دانلود نشد",False) End If End Sub
چه کدی باید به کدهای بالا اضافه کنم
لینک ارسال
به اشتراک گذاری در سایت های دیگر
1 پاسخ به این سوال تاکنون داده شده است
ارسال های توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.