Use WebView to show HTML - Android android.webkit

Android examples for android.webkit:WebView

Description

Use WebView to show HTML

Demo Code

import android.webkit.WebView;

public class Main {

  public final static void webViewLoadData(WebView web, String html) {
    StringBuilder buf = new StringBuilder(html.length());
    for (char c : html.toCharArray()) {
      switch (c) {
      case '#':
        buf.append("%23");
        break;/*from   w w w .  j  a va 2  s  .  com*/
      case '%':
        buf.append("%25");
        break;
      case '\'':
        buf.append("%27");
        break;
      case '?':
        buf.append("%3f");
        break;
      default:
        buf.append(c);
        break;
      }
    }
    web.loadData(buf.toString(), "text/html", "utf-8");
  }

}

Related Tutorials