掉用js方法
掉用:
String result = "javascript:showImage(\""+file+"\")"; this.webView.loadUrl(result);
添加
function showImage(param){
}
掉用java方法
添加:
webView.addJavascriptInterface(new CameraInterface(this), "CameraInterface");
掉用:
window.CameraInterface.openCamera("heller");
public class CameraInterface { private OpentCamera mContext; public CameraInterface(OpentCamera context){ this.mContext = context; } @JavascriptInterface public String Test() { Logger.d("-----------", "当前被掉用"); return "aaaaa"; } /** * 打开相机 * @param path */ @JavascriptInterface public void openCamera(String path) { Logger.d("-----------", "当前被掉用"); mContext.createCamertLinear(); } public interface OpentCamera { void createCamertLinear(); }