Full Android Android Integration

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?

+6
java python android jython ase
source share
1 answer

ASE is probably the way to go.

I'm not a Jython expert, but I expect that part of the problem with trying to go this route is that Android is actually not Java - while the underlying language is the same, Java Java code does not have any of "standard" Java libraries and it compiles into its own bytecode language.

Having said that, there is no existing project for using Jython with Android. Its author killed the project and directs users to ASE:

http://code.google.com/p/jythonroid/

0
source share

All Articles