iOS Question What is the B4i name of the B4A name "file:///android_asset/"

klaus

Expert
Licensed User
Longtime User
To load a file from DirAssets to a WebView we use
in B4A: wbvHelp.LoadUrl("file:///android_asset/" & HelpFile)
in B4i: wbvHelp.LoadUrl("file:///???/" & HelpFile)
 

cbanks

Active Member
Licensed User
Longtime User
I have the following code in an Html Page that I load into a webview in b4a. It pulls a jpg file from the assets folder. What do I need to change in the html code so that it pulls the jpg file from the assets folder using b4i? It's not working in b4i.

B4X:
<img src="file:///android_asset/hymns.jpg" width="100">
 
Upvote 0

cbanks

Active Member
Licensed User
Longtime User
No, I'm using loadurl to load a web page. The web page contains the code mentioned previously. It works just fine in b4a but not b4i.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
This code works for me:
B4X:
Dim linktoimage as String
linktoimage = File.Combine(File.DirAssets, "pic.png")
WebView1.LoadHtml("<html><head></head><body><img src=' " & linktoimage & " '></body></html>")
 
Upvote 0
Top