Main. xml is as follows: [html] <RelativeLayout xmlns: android =" http://schemas.android.com/apk/res/android "Xmlns: tools =" http://schemas.android.com/tools "Android: layout_width =" match_parent "android: layout_height =" match_parent "tools: context = ". mainActivity "> <WebView android: id =" @ + id/webView "android: layout_width =" fill_parent "android: layout_height =" fill_parent "android: layout_centerHorizontal =" true "android: layout_centerVertical = "true"/> </RelativeLayout> MainActivity: [java] package com. example. testgetwebviewcontent; import android. app. activity; import android. graphics. bitmap; import android. OS. bundle; import android. webkit. webView; import android. webkit. webViewClient;/*** Dmeo Description: * When a WebView loads a webpage, it obtains the content of the webpage. * References :* http://www.maxters.net/2012/02/android-webview-get-html-source/ */Public class MainActivity extends Activity {private WebView mWebView; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. main); init ();} private void init () {mWebView = (WebView) findViewById (R. id. webView); mWebView. getSettings (). setJavaScriptEnabled (true); mWebView. addJavascriptInterface (new InJavaScriptLocalObj (), "local_obj"); mWebView. getSettings (). setsuppzoom zoom (true); mWebView. getSettings (). setDomStorageEnabled (true); mWebView. getSettings (). setPluginsEnabled (true); mWebView. requestFocus (); mWebView. getSettings (). setUseWideViewPort (true); mWebView. getSettings (). setLoadWithOverviewMode (true); mWebView. getSettings (). setsuppzoom zoom (true); mWebView. getSettings (). setBuiltInZoomControls (true); mWebView. loadUrl (" http://www.baidu.com "); MWebView. setWebViewClient (new WebViewClient () {@ Override public void onPageStarted (WebView view, String url, Bitmap favicon) {super. onPageStarted (view, url, favicon) ;}@ Override public boolean shouldOverrideUrlLoading (WebView view, String url) {view. loadUrl (url); return true ;}@ Override public void onPageFinished (WebView view, String url) {super. onPageFinished (view, url); view. loadUrl ("javascript: window. local_obj.showSource ('