Erel,
Thank you. It works (but you knew that!)... except for two things:
1. How do I get it to show images that are stored in a sub-folder? The code you gave will display all the images as long as they are linked/located withing the same folder as the index.html However, it will not show them if they are contain in a sub-folder within the same main/root folder where the index.html file is. Many websites are design that way, to use sub-folder for images, pdf, assets, javascript addons, etc. and, my jobs website depends on those sub-folders... I would have to redesign the entire website from scratch! Importing the images to the Assets does not work since after compiled the html files are looking for a sub-folder, and I was not able to add the sub-folder to the assets, it wouldn't let me.
2. Also, I cannot get it to show websites that contain "inline-frames" also known as "iframes". Half my website uses it. Can it be done?
But if I design a webpage and I store all the images (and other files) in the same folder as the "index.html" then it works almost perfectly... still it will not show iFrames though.
By the way, for those who are new to B4A, as I am, here is the way it works so far (most threads in the forum just give you a line of code implying/thinking you know the rest of the code...):
I made a new Activity Module and named it "Help1" (for my example, or, you can do it in the Main activity - the default one, etc.). Then, I open the "Visual Designer" and added a "WebView" box holder and named it "WVHelp" and enabled JavaScript and Zoom. I re-sized the WebView box to use most of the screen. Then I switch to the B4A code window and used the code below. I used Mozilla Komposer to make the "index.html" file which contains images and links, as well as tables and different font formatting. All the files (images, pdf, etc.) are contained withing the same folder where the "index.html" file is located. If you open this index file with any web browser it shows as intended in Komposer. Finally, I added the "index.hmtl" and all the other files to the assets window withing the B4A with the "Files" tool (located on the right lower corner of the main window, next to "Modules" and followed by "Logs" and "Libs". Also, if you have to rename all your files from your existing website to use lowercase and you don't want to do one by one, I'm happy to tell you that "Total Commander" file manager does it within seconds as a batch job with just two click after selecting them!!!
Then I compiled the app and voila! Done!
Here is the code:
Sub Globals
Dim WVHelp As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Help1")
WVHelp.LoadUrl(WebViewAssetFile("index.html"))
WVHelp.Color = Colors.Transparent 'Makes page background transparent
End Sub
Sub WebViewAssetFile (FileName As String) As String
Dim jo As JavaObject
jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File")
If jo.GetField("virtualAssetsFolder") = Null Then
Return "file:///android_asset/" & FileName.ToLowerCase
Else
Return "file://" & File.Combine(jo.GetField("virtualAssetsFolder"), _
jo.RunMethod("getUnpackedVirtualAssetFile", Array As Object(FileName)))
End If
End Sub