1. to open a webpage, you can write a webview by yourself and open it in your Program .
WV = (webview) findviewbyid (R. id. webview1);
WV. getsettings (). setjavascriptenabled (true);
WV. setscrollbarstyle (0);
websettings = WV. getsettings ();
websettings. setallowfileaccess (true);
websettings. setbuiltinzoomcontrols (true);
WV. loadurl ("http://www.baidu.com");
// load data
WV. setwebchromeclient (New webchromeclient () {
@ override
Public void onprogresschanged (webview view, int newprogress) {
If (newprogress = 100) {
mainactivity. this. settitle ("loaded");
}else {
mainactivity. this. settitle ("loading ....... ");
}< BR >});
// when a connection is clicked on the webpage
WV. setwebviewclient (New webviewclient () {
Public Boolean shouldoverrideurlloading (final webview view,
final string URL) {
loadurl (view, URL );
return true;
}< BR >});
// Goback () indicates that the previous page of webview is returned.
Public Boolean onkeydown (INT keycoder, keyevent event) {
If (WV. cangoback () & keycoder = keyevent. keycode_back) {
WV. goback ();
return true;
}< br> return false;
}< br> 2. otherwise, you will call the android built-in browser to open the webpage.
1. uri uri = Uri. parse ("http://google.com");
2. intent it = new intent (intent. action_view, Uri);
3. startactivity (it);