Loading HTML page

jmeuse2

Member
Licensed User
Longtime User
what is the [Entire] code for loading a saved web page into webview? I accidentally had it working but I didnt save my code and now I can't accidentally get it to accidentally work again.

B4X:
    WebView1.Initialize("WebView1")


    Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
    WebView1.LoadHtml("file:///android_asset", "test.htm")
 

jmeuse2

Member
Licensed User
Longtime User
Still won't load

I pasted that in but when I run the program it just types the words 'file:///android_asset/test.htm' at the top of the screen.

I added test.htm into Files.. Do I need any particular library?

I recently upgraded to 2.3 if that matters.

Thanks!

B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
    Dim WebView1 As WebView

End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
    WebView1.Initialize("WebView1")


    Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
    WebView1.LoadHtml("file:///android_asset/test.htm")
End Sub
 
Last edited:
Upvote 0

jmeuse2

Member
Licensed User
Longtime User
Still no luck

'Web Page Not Found'. I even tried another web page I named '430AMhereIcome'.

Before I upgraded, web page file extensions were recognized alike in both file properties and B4A Files. Now, file properties name the web page HTML but it saves as a HTM in B4A Files.
 
Last edited:
Upvote 0
Top