Android create html webview

From John Freier
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);