I was hoping to find something in the Android sdk similar to the javax.script package in Java; but haven't been able to find anything. Am I missing a way to execute JavaScript from my app?
- What rights would you expect it to have? What is the script actually doing?Fantius– Fantius2011-08-12 15:53:21 +00:00Commented Aug 12, 2011 at 15:53
- Why can't you do whatever the script is doing right there in Java?Fantius– Fantius2011-08-12 15:53:50 +00:00Commented Aug 12, 2011 at 15:53
- I want to be able to let users execute a script. Their scripts will interact with interfaces which I will implement in Java. (that makes sense, right?)ab11– ab112011-08-12 17:16:05 +00:00Commented Aug 12, 2011 at 17:16
Add a comment |
4 Answers
Rhino is a port of JavaScript that is implemented in Java. It can run on Android with minor tweaks. You can find the code for it as part of the SL4A project.
Comments
You can execute JavaScript from within a WebView. Make sure you set WebSettings.setJavaScriptEnabled(true).
You can find more information here.
Comments
I guess it depends on what you need the JavaScript to do. There is a way to execute JavaScript contained within HTML, ie PhoneGap.
1 Comment
Chris Sim
can u give me an example plz?