B4J Question How to load a html file from DirAssets ?

GMan

Well-Known Member
Licensed User
Longtime User
Here is the code i have, but dont work:

B4X:
    Dim url="file:\\\" & File.Combine(File.DirAssets, "help.html" As String)
    Log("Loading " & url)
    HelpWebView.LoadUrl(url)
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Actually.... It is almost all wrong, read the HTML file as a string, and load the HTML directly instead of the url.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
I used it this way and it works:

B4X:
    Dim url = File.geturi(File.DirAssets,"help.html" As String)
    Log("Loading " & url)
    HelpWebView.LoadUrl(url)

without "as String" it causes a warning
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?????

File.geturi(File.DirAssets,"help.html" As String)

1595863733189.png


Dim BaseURL As String = File.GetUri(File.DirAssets,"help.html")
HelpWebView.LoadUrl(BaseURL)
 
Last edited:
Upvote 0
Top