Dear B4A Community,
First of all I'd like to thank you all A LOT for all the help you've been to me. I learned a lot in a very small time! Great tutorials and content for people who are just starting out.
Now let's get to the point: I trying to port a program I made on the PC, to Android.
This is the code from Visual Basic:
Basically what it does, is download the source code of a page, checks for the image that matches "imgur" and downloads that image. Then the image is shown in a PictureBox.
The reason it needs to be done like this, is because the URL of the image will change every time, so I can't just hardcode the URLs.
I've tried loads of things with HttpUtils2 and ImageDownloader, but I just can't figure it out. I don't have any code to show you because I just erase code and try all over again if it faisl and I have nothing which comes near working.
If someone could please direct me to the right path, I'd GREATLY appreciate it.
Showing the image in a WebView is good too, because it allows zooming by default.
Thanks in advance,
Dysanix
EDIT: Even if this isn't possible with the free Trail version, I'd still like the answer for when I buy the program or when other people need help with the same problem!
First of all I'd like to thank you all A LOT for all the help you've been to me. I learned a lot in a very small time! Great tutorials and content for people who are just starting out.
Now let's get to the point: I trying to port a program I made on the PC, to Android.
This is the code from Visual Basic:
B4X:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Try
Dim htmlDocument As HtmlDocument = Me.WebBrowser1.Document
Dim htmlElementCollection As HtmlElementCollection = htmlDocument.Images
Dim ImagesFound As Integer = 0
For Each htmlElement As HtmlElement In htmlElementCollection
Dim imgUrl As String = htmlElement.GetAttribute("src")
If imgUrl.Contains("imgur") Then
ImagesFound += 1
Select Case ImagesFound
Case 1
PictureBox1.ImageLocation = imgUrl
End Select
End If
Next
Catch ex As Exception
End Try
End Sub
Basically what it does, is download the source code of a page, checks for the image that matches "imgur" and downloads that image. Then the image is shown in a PictureBox.
The reason it needs to be done like this, is because the URL of the image will change every time, so I can't just hardcode the URLs.
I've tried loads of things with HttpUtils2 and ImageDownloader, but I just can't figure it out. I don't have any code to show you because I just erase code and try all over again if it faisl and I have nothing which comes near working.
If someone could please direct me to the right path, I'd GREATLY appreciate it.
Showing the image in a WebView is good too, because it allows zooming by default.
Thanks in advance,
Dysanix
EDIT: Even if this isn't possible with the free Trail version, I'd still like the answer for when I buy the program or when other people need help with the same problem!
Last edited: