I'm trying to make an standard Android application execute a python script that could return values to Java, but I'm facing a lot of issues.

Jython doesnt support this in the Android environment, SL4A is a dead project, Kivi seems to be an full stack framework that do not use Java at all and QPython is SL4A that works on Android 5+ but almost don't have documentation.

I wanted something like:

// From INSIDE my Java Code

new PythonEngine().execute('a = 1 + 1').getInt('a')

With QPython I found an example that executes an arbitrary code, but I couldn't figure how to get the outcome and how to run the script without opening a new activity that waits for user input to come back.

Is that possible? The example can be found here QPython Java Sample

解决方案

I don't think any of thoses projects will help. For example, Kivy drive the Python execution, even it it's started from Java.

If you have an application in Java, but want to start a Python Interpreter, i guess solution using https://code.google.com/p/android-python27/ might be a start. Unsure if they have a Java interface in top of the Python C-API.

更多相关文章

  1. Android中短信拦截解决方案
  2. android开机自启广播无效果的曲线解决方案
  3. Android的低级错误
  4. Android(安卓)软键盘遮挡三种解决方案
  5. ReactNative异常:{"errno":-4048,"code":"EPERM","syscall":"
  6. Android(安卓)studio 3.1.3 无法获取pom文件
  7. Android模拟器无法上网解决方案
  8. Android(安卓)Studio BUILD FAILED finished with non-zero exit
  9. 【适配】【转】Android开发:最全面、最易懂的Android屏幕适配解决

随机推荐

  1. android Tabhost部件(详细)
  2. Android之视频播放
  3. android常见问题
  4. Android(安卓)Studio如何允许访问网络资
  5. android震动器
  6. Activity中那些需要重写的方法
  7. android中的页面跳转问题解决
  8. Android中使EditText失去焦点,禁止弹出键
  9. 若干小问题
  10. Android实现仿网易新闻主界面设计