Loading html file into WebView

Andras

Active Member
Licensed User
Longtime User
I have no problems loading picture files stored (originally!) in the Files directory into an ImageView, but can't load an html file stored in the same place into a WebView as I get a File Not Found error; why doesn't this code work, and what needs to change?

FileName = "testfile.html"
WebView1.LoadUrl ("file:///DirAssets" & FileName)

Thanks for help!

John
 

susu

Well-Known Member
Licensed User
Longtime User
For WebView, to load your html file you must use this path:

WebView1.LoadUrl("file:///android_asset/testfile.html")
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Thanks - I'd tried that earlier and I've just tried it again, but I still get File Not Found. And I know that the file is there because I put it there earlier and it's still there!

I have tried playing around with upper and lower-case letters, having been caught out like that before, but it makes no difference.

John
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Sorted! Simply a problem with the program flow that I'd misinterpreted ;-(

Thanks to both for the help; Erel made me look in the right place with his promise to examine the whole code!

John
 
Upvote 0
Top