Android click to jump to the page you want to display

Source: Internet
Author: User

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);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.