I'm using crosswalk now. I need to call a Java method when a user clicks a button in the HTML, which may look like:
<a href="#" onclick="callJava()">Start</a>
I'm not sure if Crosswalk extension is what I wanted, which seems to be so heavy-weighted just for calling a Java function.
Is there a simpler way to do this? Or should I use Cordova with Crosswalk in this case?
If you are only using XWalkView as an embedded view, the addJavascriptInterface
is sufficient to inject Java object into XWalkView(JavaScript), which is just like the addJavascriptInterface
in android.webkit.WebView:
https://crosswalk-project.org/apis/embeddingapidocs_v2/reference/org/xwalk/core/XWalkView.html
http://developer.android.com/guide/webapps/webview.html#BindingJavaScript