Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use javax.script in Android development and if yes how?

I'm having a bit of trouble with including javax.script.*; in an Android project. I need it so I can use the "eval" function in JavaScript, in order to parse arithmetic functions efficiently, without building a parser myself (I have utterly no experience in that and not a lot of time on my hands).

Is there any chance to use JavaScript or the "eval" function or something similar in my Android app?

Thanks for any info you can give me

like image 454
Eugen Avatar asked Aug 06 '11 15:08

Eugen


2 Answers

Execute the JS code with webview

like image 154
Changwei Yao Avatar answered Nov 18 '22 12:11

Changwei Yao


Try JEXL. It should do what you need but is simpler than the entire Javascript interpreter.

like image 2
Sarel Botha Avatar answered Nov 18 '22 14:11

Sarel Botha