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