Wirelessly how Java and JS interact

Source: Internet
Author: User

1, wirelessly Java and JS how to interact

How to implement Java and JS interaction on Android? Android WebView is based on the WebKit kernel,webview Integration of JS and Java Intermodulation interface functions, through the Addjavas Criptinterface method, Java class can be registered into the WebKit, to the Web page JS call, but also through the Loadurl method is to WebKit pass a URL for the browser to parse, Java and JS interaction.

To run the JS script on the Web page, WebView must be set to support Javas Cript.

2, the MVC of Android

1) View layer: The general use of XML file interface description, when used can be very convenient to introduce. Of course, how you learn more about Android, you can think of Android can also use javascript+html and other ways as the view layer, of course, there is a need for Java and JavaScript communication between, fortunately, Android provides a very convenient communication implementation between them.

2) control layer (Controller): The task of Android control layer usually falls on the shoulders of many acitvity, this phrase also implies do not write code in acitivity, to through activity delivery model business Logic layer processing, Another reason for this is that the response time of Acitivity in Android is 5s, and if time-consuming operations are put here, the program is easily recycled.

3) Model: the operation of the database, the operation of the network, etc. should be processed in the model, of course, business calculations and other operations must be placed in the layer. is the binary data in the application.

3. How to read the code Eclipse Project: First Look at Androidmanifest.xmlpackage name, app name4.

Another refresh Project task is currently running for the project

All definitions and sentences >> Another Refresh Project task is currently running project

Wirelessly how Java and JS interact

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.