网页端:
function open(){
window.agf.openvip();
}
Android 端 :
webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient());
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
webView.addJavascriptInterface(new MyObject(), "agf");
public class MyObject{
@JavascriptInterface
public void openvip(){
//业务代码
}
}