K kormos Member Licensed User Longtime User Dec 8, 2011 #1 I have added a picture in my project and I have checked the checkbox on the left side of the file name. I try to display the image on a WebView. How can I get the image path? I set the contents of the WebView using the LoadHtml member function. Code: WebView1.LoadHtml("<b>Test</b><br><img src='Chrysanthemum.jpg'>") How can I get the path of the embeded image that I have put in my project?
I have added a picture in my project and I have checked the checkbox on the left side of the file name. I try to display the image on a WebView. How can I get the image path? I set the contents of the WebView using the LoadHtml member function. Code: WebView1.LoadHtml("<b>Test</b><br><img src='Chrysanthemum.jpg'>") How can I get the path of the embeded image that I have put in my project?
klaus Expert Licensed User Longtime User Dec 8, 2011 #2 You shouldn't check the the checkbox at the left, this is used for removing files ! The path name for the embedded files is the variable File.DirAssets. So you code should look like this: Code: WebView1.LoadHtml("<b>Test</b><br><img src='" & File.DirAssets & "/Chrysanthemum.jpg'>") Best regards. Upvote 0
You shouldn't check the the checkbox at the left, this is used for removing files ! The path name for the embedded files is the variable File.DirAssets. So you code should look like this: Code: WebView1.LoadHtml("<b>Test</b><br><img src='" & File.DirAssets & "/Chrysanthemum.jpg'>") Best regards.
K kormos Member Licensed User Longtime User Dec 8, 2011 #3 I tryed it but it displayes a blue box with a question mark inside. I suppose this is image is displayed there in order to inform me that the control did not find the image. Upvote 0
I tryed it but it displayes a blue box with a question mark inside. I suppose this is image is displayed there in order to inform me that the control did not find the image.
S susu Well-Known Member Licensed User Longtime User Dec 8, 2011 #4 Try this code: WebView1.LoadHtml("<b>Test</b><br><img src='file:///android_asset/Chrysanthemum.jpg'>") Click to expand... Upvote 0
Try this code: WebView1.LoadHtml("<b>Test</b><br><img src='file:///android_asset/Chrysanthemum.jpg'>") Click to expand...
klaus Expert Licensed User Longtime User Dec 8, 2011 #5 I had a look at the WebView help and saw that to access files in the assets folder the code should look like the following: Code: WebView1.LoadHtml("<b>Test</b><br><img src='file:///android_asset/Chrysanthemum.jpg'>") I'm not shure if the beginning of your html text is correct. Perhaps you should use: Code: [COLOR=#000000]WebView1.LoadHtml([/COLOR][COLOR=#800000]"[/COLOR][COLOR=#800000]<html><body><img src='file:///android_asset/[/COLOR]chrysanthemum.jpg[COLOR=#800000]'/></body></html>[/COLOR][COLOR=#800000]"[/COLOR][COLOR=#000000])[/COLOR] Best regards. Upvote 0
I had a look at the WebView help and saw that to access files in the assets folder the code should look like the following: Code: WebView1.LoadHtml("<b>Test</b><br><img src='file:///android_asset/Chrysanthemum.jpg'>") I'm not shure if the beginning of your html text is correct. Perhaps you should use: Code: [COLOR=#000000]WebView1.LoadHtml([/COLOR][COLOR=#800000]"[/COLOR][COLOR=#800000]<html><body><img src='file:///android_asset/[/COLOR]chrysanthemum.jpg[COLOR=#800000]'/></body></html>[/COLOR][COLOR=#800000]"[/COLOR][COLOR=#000000])[/COLOR] Best regards.
K kormos Member Licensed User Longtime User Dec 8, 2011 #6 After testing all the options the only way that worked for my project is the following. Code: WebView1.LoadHtml("<html><body><img src='file:///android_asset/chrysanthemum.jpg'/></body></html>") I also want to make one more question if you can help my. If VB.NET you can place the " character in a string by typing it twice. For expample you can have a string variable like this: Code: Dim MyString as String = "My name is ""Manos"" and I am from Greece" This has as a result to store in the string the following value: My name is "Manos" and I am from Greece Also there is a constant for changing line in a string called vbCrLf. Is there a way to put the CrLf in a string like a constant or like a code inside the string. Upvote 0
After testing all the options the only way that worked for my project is the following. Code: WebView1.LoadHtml("<html><body><img src='file:///android_asset/chrysanthemum.jpg'/></body></html>") I also want to make one more question if you can help my. If VB.NET you can place the " character in a string by typing it twice. For expample you can have a string variable like this: Code: Dim MyString as String = "My name is ""Manos"" and I am from Greece" This has as a result to store in the string the following value: My name is "Manos" and I am from Greece Also there is a constant for changing line in a string called vbCrLf. Is there a way to put the CrLf in a string like a constant or like a code inside the string.
NJDude Expert Licensed User Longtime User Dec 8, 2011 #7 This should work: Code: Dim MyString as String MyString = "My name is " & QUOTE & "Manos" & QUOTE & " and I am from Greece" There's a constant CRLF in B4A Code: MsgBox("Hello" & CRLF & "There", "") Upvote 0
This should work: Code: Dim MyString as String MyString = "My name is " & QUOTE & "Manos" & QUOTE & " and I am from Greece" There's a constant CRLF in B4A Code: MsgBox("Hello" & CRLF & "There", "")
klaus Expert Licensed User Longtime User Dec 8, 2011 #8 Code: Dim MyString As String MyString = "My name is " & Chr(34) & "Manos" & Chr(34) & " and " & CRLF & "I am from Greece" Gives: My name is "Manos" and I am from Greece. Best regards. Upvote 0
Code: Dim MyString As String MyString = "My name is " & Chr(34) & "Manos" & Chr(34) & " and " & CRLF & "I am from Greece" Gives: My name is "Manos" and I am from Greece. Best regards.