If you want to display some Web pages in your application and embed a browser in your application, you can use the WebView control to call the Loadurl () method to load the display
The corresponding Web page.
WebView = (WebView) Findviewbyid (R.id.web_view); Webview.loadurl ("http://www.baidu.com");
You may also jump directly to the system browser and need to override the Shouldoverrideurlloading () method to implement jumps in the WebView.
Webview.setwebviewclient (new webviewclient () { @Override publicBoolean shouldoverrideurlloading (WebView view, String URL) { // TODO auto-generated method Stub View.loadurl (URL); Load a new page based on the parameters passed in
returntrue; //indicates that the current WebView can handle requests to open a new webpage without using the System browser
} }); Webview.loadurl (URL);
We also need to add permissions to the Androidmanifest.xml, otherwise the URL will be inaccessible
< Manifest > ... < android:name= "Android.permission.INTERNET"/> ... </ Manifest >
To open a Web page in an application using WebView