Getting HTML text into a webView

rfresh

Well-Known Member
Licensed User
Longtime User
I want to put some HTML text I created in my html editor into my webview via

B4X:
WebView1.LoadHtml("<html><body>Hello world!</body></html>")

But my HTML text spans multiple lines so it breaks the compiler. I searched for multiple lines and saw the _ char and added those to the end of each line but that didn't work. I guess those are not for HTML text.

I'd hate to have to run the text together on one line. Is there anyway to get multiple lines in HTML to work with the LoadHtml method?

Thanks...
 

admac231

Active Member
Licensed User
Longtime User
Like this:
B4X:
   WebView1.LoadHtml("<html><body>Hello world!"& _
   "<br/>Second line"& _
   "<br/>Third line</body></html>")

Or you could just save the HTML file into the assets folder and load it into the webview.
 
Upvote 0
Top