How to execute JavaScript on Android?

AndroidJSCore is a great one. And here is another little library I wrote for evaluating JavaScript:

https://github.com/evgenyneu/js-evaluator-for-android

jsEvaluator.evaluate("function hello(){ return 'Hello world!'; } hello();", new JsCallback() {
  @Override
  public void onResult(final String result) {
    // get result here (optional)
  }
});

It creates a WebView behind the scenes. Works on Android version 3 and newer.

Leave a Comment

tech