I am utilizing the following code to successfully download a set if jpg files from web server. All of the image files download successfully, but something is wrong, as they are not being recognized as jpgs by the device. They will not load in gallery (just a blank screen), and when I try to access them using LoadBitMap, I get Error Loading Bitmap. Hopefully someone can help me figure out the problem.
B4X:
Sub get_images
HttpUtils.CallbackActivity = "Main" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "JobDone"
'HttpUtils.Download("Job1", FileUrl)
Dim file_to_add As String
file_list.Initialize
cursor1=sql1.ExecQuery("Select * from images")
For i=0 To cursor1.RowCount-1
cursor1.Position=i
file_to_add="http://mywebserver/images/" & """" & cursor1.GetString("IMAGE_FILE") & """"
file_list.Add(file_to_add)
Next
HttpUtils.DownloadList("Job2", file_list)
End Sub
Sub JobDone (Job As String)
Dim link As String
Dim file_name As String
For i = 0 To HttpUtils.Tasks.Size - 1
link = HttpUtils.Tasks.Get(i)
file_name=link.SubString(27) 'extracts just the filename from file_to_add
File.Copy2(HttpUtils.GetInputStream(link),File.OpenOutput(File.DirDefaultExternal,file_name,False))
Log(link & ": success=" & HttpUtils.IsSuccess(link))
Next
Msgbox("DONE","")
End Sub