FinalTextView Txttitle =(TextView) Findviewbyid (r.id.txttitle); FinalWebView WebView =(WebView) Findviewbyid (R.id.btnwebview); Webchromeclient WVCC=Newwebchromeclient () {@Override Public voidOnreceivedtitle (WebView view, String title) {Super. Onreceivedtitle (view, title); Txttitle.settext ("Receivedtitle:" +title); } };//set Setwebchromeclient Objectwebview.setwebchromeclient (WVCC);//Create a Webviewclient objectWebviewclient WVC =Newwebviewclient () {@Override Public Booleanshouldoverrideurlloading (WebView view, String URL) {//use your own WebView component to respond to URL load events instead of loading pages with the default browserwebview.loadurl (URL); //consume this event. Return true in Android that's it, the event will not bubble pass, we call it consumption return true; } };
Webview.setwebviewclient (WVC); }
Android WebView Gets the title of the page