Android Javascript:android and JavaScript call each other

Source: Internet
Author: User
Tags html page interface

The following section describes how Android and JavaScript are called each other, so our UI interface is much simpler to design, and the UI is designed to be cross-platform. There are a lot of web app foreground frames, such as Sencha and jquery mobile. Believe in the future with the development of web apps, we can also use HTML to design the same beautiful interface as the local application. Although these are beautiful, but now there are many drawbacks, such as the call than the local framework is much slower, because the mobile phone is a limited device, so the processing and response are relatively slow, expect a greater development in the future. Ha ha!
Nonsense not much to say, below to write a Webviewdemo implementation of Android and JavaScript to call each other.
Let's take a look at what controls Main.xml uses:

Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Vertical" >
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:text= "@string/hello"/>
Android:id= "@+id/webview"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:id= "@+id/button"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:text= "Invoke JavaScript"

And then give us our demo.html page.

insert Title here

name Telephone
Xiao Ming 123
Xiao Wang 456

html raw data

this article link

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: 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.