Soni Ali
Soni Ali

Reputation: 19000

Evaluate a script (e.g. Python) in Java for Android platform

Is it possible to evaluate a string of python code (or Perl) from Java when developing Android applications?

I am trying to do something like evaluating a text-input script:

String script = text1.getText().toString();
String result = PythonRuntime.evaluate(script);
text2.setText(result);

Upvotes: 3

Views: 494

Answers (2)

retracile
retracile

Reputation: 12339

In case you weren't aware of it, the Android Scripting Environment might be useful to you, though I don't think it does exactly what you're looking for.

Upvotes: 5

jsight
jsight

Reputation: 28409

Jython and its derivatives should be able to do this. See also Jythondroid.

Upvotes: 4

Related Questions