Android examples for User Interface:WebView
load Content To WebView
import android.util.Log; import android.webkit.WebView; import java.net.URLEncoder; public class Main{ public static final String UTF8 = "utf-8"; public static final String HTML = "text/html"; private static final String FAKE_URL = "fake://fuck/android"; public static void loadToWebView(WebView webView, String content) { webView.loadDataWithBaseURL(FAKE_URL, WebUtils.wrapWithHtml(content), WebUtils.HTML, WebUtils.UTF8, ""); }/*from ww w . j a v a2s . co m*/ public static String wrapWithHtml(String content) { return "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head><body>" + content + "</body></html>"; } }