Android create html webview

From John Freier
Revision as of 16:39, 20 June 2011 by Jfreier (Talk | contribs) (Created page with 'This creates and html page and uses the webview to display it. String html = "<html><body>Hello, World!</body></html>"; String mime = "text/html"; String encoding = "utf-8"; …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This creates and html page and uses the webview to display it.

String html = "<html><body>Hello, World!</body></html>";
String mime = "text/html";
String encoding = "utf-8";

WebView myWebView = (WebView)this.findViewById(R.id.webView1);
myWebView.getSettings().setJavaScriptEnabled(false);
myWebView.loadDataWithBaseURL(null, html, mime, encoding, null);