Friday 15 July 2011

Android - Use WebView to evaluate a javascript string and return the value -


Given that the scripting in Android is not basically supported and wrapping the library such as javax.script.ScriptEngine your app Will make it too big, is it possible to send JavaScript strings for an invisible webvive and evaluate the string and return the result (the second string) to you?

I want to go this route because I want to save all my script so my app can remain small for the disc.

edit

I need a Java code, not in other ways to evaluate the JavaScript string. addJavascriptInterface () does not help.

Can it be done? Yes, addJavascriptInterface () and browser by sending a javascript: URL, similar to a bookmarklet.

A very simple answer, which will use very little memory and will be executed very fast, do not use javascript.


No comments:

Post a Comment