Thursday, 18 August 2016

     In the following example we are going see about the webview and load some html code into the newly created webview in android, in the previous post we are seen about creating the webview and load the url into that webview


If you don't know how to create webview in android studio please click here

Code for load html code directly to webview
String html = "<html><body>This is the test webview</body></html>";
String mime = "text/html";
String encoding = "utf-8";









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


Html code into webview

0 comments:

Post a Comment