Is it possible to call/run a python script file from Java code on the Android platform using SL4A? Basically I have a full blown Java Android app and I have several Python scripts that scrape some information from various web pages. I would like to be able to call these python scripts with the web page and get the results back. Is this possible? If so, can anyone point me in the direction of an example or two?
Thank you, Harry
You can use Java Runtime. exec() to run python script, As an example first create a python script file using shebang and then set it executable.
Using the PythonInterpreter class allows us to execute a string of Python source code via the exec method. As before we use a StringWriter to capture the output from this execution. In this example we see how we can use the get method, to access the value of a variable.
First thing first, you can use various other languages as well for the android app development. These languages involve- Python, Java, Kotlin, C, C++, Lua, C#, Corona, HTML5, JavaScript, and some more.
run an SL4A script from my application?
http://code.google.com/p/android-scripting/wiki/FAQ#Can_I_run_an_SL4A_script_from_my_application?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With