要將android java代碼中的變量傳遞到webView的javascript中,使用javascript接口。但是系統(tǒng)警報:undefinedjava的部分代碼public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
@JavascriptInterface
public int getValue() {
return 5;
}
}Javascript代碼:function getValue() {
Android.getValue();
}
var value = getValue();
alert(value);接口名為android。不知道哪里出的錯?高手解答,謝謝。
添加回答
舉報
0/150
提交
取消