H hasexxl1988 Active Member Licensed User Longtime User May 29, 2012 #1 Hello, I wanted to ask if I can help those who may have already looked at HTTP examples, but does not continue anyway. Perhaps a solution-oriented whoever. Here is my code, what does not. : ( ImageView1.Bitmap = LoadBitmap ("http://img24.imageshack.us/i/","d3100.jpg")
Hello, I wanted to ask if I can help those who may have already looked at HTTP examples, but does not continue anyway. Perhaps a solution-oriented whoever. Here is my code, what does not. : ( ImageView1.Bitmap = LoadBitmap ("http://img24.imageshack.us/i/","d3100.jpg")
NJDude Expert Licensed User Longtime User May 29, 2012 #2 You cannot do that, the syntax is: Code: Copy LoadBitmap (Dir As String, FileName As String) As Bitmap To do what you want you have to download the picture and then load it to the ImageView Upvote 0
You cannot do that, the syntax is: Code: Copy LoadBitmap (Dir As String, FileName As String) As Bitmap To do what you want you have to download the picture and then load it to the ImageView
netchicken Active Member Licensed User Longtime User May 29, 2012 #3 here is some code I have been working on, in the link below this is only part of the code. 'dim stuff Code: Copy Dim hcimage As HttpClient 'download the image Dim reqimage As HttpRequest get the image - pic being image name Code: Copy Dim imagepath As String imagepath = "http://m.metservice.com/sites/all/themes/mobile/images/wx-icons/"& pic reqimage.InitializeGet(imagepath) hcimage.Execute(reqimage, 1) save it Code: Copy Sub hcimage_ResponseSuccess(Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("ImageResponse", _ File.OpenOutput(File.DirInternalCache, pic, False), True, TaskId) End Sub 'load image auto Code: Copy Sub ImageResponse_StreamFinish (Success As Boolean, TaskId As Int) If Success = False Then Msgbox(LastException.Message, "Error") Return End If imgtemp.Bitmap = LoadBitmap(File.DirInternalCache, pic) End Sub 'load the image manually Code: Copy If File.Exists(File.DirInternalCache, pic) Then 'if so then load it imgtemp.Bitmap = LoadBitmap(File.DirInternalCache, pic) Upvote 0
here is some code I have been working on, in the link below this is only part of the code. 'dim stuff Code: Copy Dim hcimage As HttpClient 'download the image Dim reqimage As HttpRequest get the image - pic being image name Code: Copy Dim imagepath As String imagepath = "http://m.metservice.com/sites/all/themes/mobile/images/wx-icons/"& pic reqimage.InitializeGet(imagepath) hcimage.Execute(reqimage, 1) save it Code: Copy Sub hcimage_ResponseSuccess(Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("ImageResponse", _ File.OpenOutput(File.DirInternalCache, pic, False), True, TaskId) End Sub 'load image auto Code: Copy Sub ImageResponse_StreamFinish (Success As Boolean, TaskId As Int) If Success = False Then Msgbox(LastException.Message, "Error") Return End If imgtemp.Bitmap = LoadBitmap(File.DirInternalCache, pic) End Sub 'load the image manually Code: Copy If File.Exists(File.DirInternalCache, pic) Then 'if so then load it imgtemp.Bitmap = LoadBitmap(File.DirInternalCache, pic)
Erel B4X founder Staff member Licensed User Longtime User May 30, 2012 #4 Also check HttpUtils. In most cases it is easier (and safer) to use HttpUtils. Upvote 0
A achtrade Active Member Licensed User Longtime User Mar 16, 2015 #5 what is the best way to download a pic, using this method or FTP ? https://www.b4x.com/android/forum/threads/android-ftp-tutorial.10407/ Upvote 0
what is the best way to download a pic, using this method or FTP ? https://www.b4x.com/android/forum/threads/android-ftp-tutorial.10407/
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2015 #6 Please start a new thread for this question. This is an old thread. Upvote 0