此URL显示了如何使用:http://zhangwenli.com/blog/2014/08/25/crosswalk-calling-java-methods-with-javascript/
但是,getSettings()函数现在被删除了。
现在如何启用Javascript?
发布于 2015-05-15 13:29:25
public class MyActivity extends Activity {
private XWalkView xWalkWebView;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_activity_xml);
xWalkWebView = (XWalkView)findViewById(R.id.xwalkView);
xWalkWebView.addJavascriptInterface(new WebAppInterface(), "Android");
xWalkWebView.load(url_your_want_to_load,null);
}
public class WebAppInterface {
@org.xwalk.core.JavascriptInterface
public void callFunction(){
// Do your Android Stuff here
}
}
}现在将页面中的函数调用为:
Android.callFunction();https://stackoverflow.com/questions/29440153
复制相似问题