Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML to browser.

 
Steven Mann
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to display local HTML in webview. So the idea would be to have a string with HTML in it, and then for the browser to read it and display it. How do I do this?
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have your HTML as String or you can also bundle your HTML file in the res/raw folder, write a routine to open the rawstream and convert it into a string and then pass it to the WebView for display.

If you make HTML inline, your code would look something like:



If you bundle your HTML as a raw file you can get the remote stream using:


Hope that helps..
 
Shawn Franks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steven Mann wrote:I need to display local HTML in webview. So the idea would be to have a string with HTML in it, and then for the browser to read it and display it. How do I do this?



Also if it is not a file that needs to be altered. You can store the file in the assets directory as a file called myhtml.js pr similar and have its content be:



And then code it into your java app as is.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic