Developing Android (2) using HTML5 to build HTML5 apps---Android

Source: Internet
Author: User

Use the WebView control in the same way as other controls use a <WebView> label in layout

WebView does not include the navigation bar, the address bar and other full browser functions, only for displaying a Web page

Load a Web page in WebView, using loadurl ()

WebView Mywebview = (WebView) Findviewbyid (R.id.webview);   Mywebview.loadurl ("http://www.example.com");  

Note include access to the Internet in the manifest file:

XML code
<uses-permission android:name= "Android.permission.INTERNET"/>  

Click on a link in Android, the default is to invoke the application to start, so webview need to handle this action on behalf of Webviewclient

Java code
Set Webviewclient   webview.setwebviewclient (New Webviewclient () {public          Boolean shouldoverrideurlloading ( WebView view, String URL) {              view.loadurl (URL);              return true;          }         public void onpagefinished (WebView view, String URL) {               super.onpagefinished (view, URL);       }       public void onpagestarted (WebView view, String URL, Bitmap favicon) {           super.onpagestarted (view, URL, favicon);       }   });  

Developing Android (2) using HTML5 to build HTML5 apps---Android

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.