Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Url)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
        File.Copy2(j.GetInputStream, out)
        out.Close
    End If
    j.Release
    Return j.Success
End Sub
Sub Button1_Click
dim Url as string = "https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/70/70838.jpg?1442421564"
dim Dir as string = File.DirRootExternal
dim FileName as string =  "pictures/1.jpg"
Wait For (DownloadAndSave(Url, Dir ,FileName )) Complete (Success As Boolean)
If Success Then
                ToastMessageShow( "Saved " & File.Combine(Dir ,FileName),True)
              End If
End Sub