Is there a way to fully integrate Python with Java code on the Android platform?
Yes, I saw a question about running Python on Android and Android Scripting for Android (ASE) .
But that doesn't seem to be enough (correct me if I'm wrong). I wanted to be able to not only call a Python script from Java code, but also have full integration. The feature that I need most is the ability to save the execution state of the code in python and be able to run several pieces of code on demand against the same execution state.
On JavaSE, I will rely on Jython. I believe that his simplest example shows everything (and some other functions too, for example, something that I would call an introspection of the state of variables):
// http://www.jython.org/archive/21/docs/embedding.html PythonInterpreter interp = new PythonInterpreter(); System.out.println("Hello, brave new world"); interp.exec("import sys"); interp.exec("print sys"); interp.set("a", new PyInteger(42)); interp.exec("print a"); interp.exec("x = 2+2"); PyObject x = interp.get("x"); System.out.println("x: "+x); System.out.println("Goodbye, cruel world");
Is this possible on Android? Is there an ASE way?
java python android jython ase
Grzegorz oledzki
source share