basic4android download file code

961 views Asked by At

how can i add download db file code for this codes from URL ?

=================================================================== { *Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("lay1pezeshki") Dim jobname As String

    job.Initialize("downloadfile",Me)

    timer1.Initi
alize("t1",2000)
        timer1.Enabled=True 




        Dim ruta As String
        If File.ExternalWritable Then
                ruta = File.DirDefaultExternal
            Else
                ruta = File.DirInternal
        End If
        If File.Exists(ruta,"uromkartbank.db")Then
            File.copy(File.DirAssets,"uromkartbank.db",ruta,"uromkartbank.db")
        End If
        sql1.Initialize(ruta,"uromkartbank.db",True)
        Dim cur1 As Cursor
        cur1 =sql1.ExecQuery("select * from پزشکی")
        Dim i As Int

        For i=0 To 10

        cur1.Position = i
        b = ListView1.TwoLinesLayout.SecondLabel
        b.TextSize = 10
    b.TextColor= Colors.Red
    c = ListView1.TwoLinesLayout.Label
        c.TextSize = 18
    c.TextColor= Colors.White
        ListView1.AddTwoLines(cur1.GetString("name") &("--------------")& cur1.GetString("takhfif"),cur1.GetString("addres"))
        Next

    End Sub* 

}

1

There are 1 answers

0
mikeward2534 On
fileURL = "http://dl.dropbox.com/u/25045/file.jpg" 'File To Download
HttpUtils.CallbackActivity = "myactivity" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "DownloadFinished"
HttpUtils.Download("Job1", fileURL)


Dim out As OutputStream
out = File.OpenOutput(File.DirInternal, "file.jpg", True)
File.Copy2(HttpUtils.GetInputStream(imgurl), out)
out.Close