A review of WebView

Source: Internet
Author: User

Recently I do not know why, the company put forward to use webview, steal laughter. In the Green soft class when learning this thing, is that the conditions are more tense can be brought to sucks, now the company's mobile phone developers a lot, do a good job, put the native UI do not have to fashion what webview. Unexpectedly, unexpectedly, they actually do not know how to pass the ginseng, hahaha. Although clearly remember that there is a general, but flaky words I will not say, so come back or review or bad to fill a bit, make some notes as follows.

Webview.getsettings (). setjavascriptenabled (true); Webview.getsettings (). Setjavascriptcanopenwindowsautomatically (true);

Above are the parameters for setting some WebView controls.

The path JSP can pass through the URL, and the return value should be troublesome, except for the above, there are:

Webview.setwebchromeclient (new  webchromeclient ()); Webview.setwebviewclient (New Webviewclient ());

We need to do a class backup first:

 Public class Qingsoftjs {    private  context context;          Public Qingsoftjs (Context context) {        this. Context= context;    }        @JavascriptInterface    publicvoid  showmessage (String mes) {        Toast.maketext (Context, MES, Toast.length_long). Show ();    }    }

The main thing is to make a note of the method. The object is then bound to a JS object by the Addjavascriptinterface method of the WebView object, and the JS object name is specified by a string parameter. This allows the JSP page to invoke the annotated method through this JS object, and this method can take parameters, so we can do a lot of things through this interface.

Oh, it's amazing, what do you want DWR to do with the Java code directly from JS? In fact, I started to think of it is not like this, it seems that there is an Android backstage monitoring what, completely want to crooked, fortunately no openings or embarrassing lost big. But the method is definitely not in this kind of, who said that using the socket to write a set of listening is absolutely not feasible? But there are ready-made methods, I do not need to spell, too silly too silly.

A review of WebView

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.