简体   繁体   English

使用Java for Android平台评估脚本(例如Python)

[英]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? 在开发Android应用程序时,是否可以从Java评估一串python代码(或Perl)?

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);

如果您不了解它, Android脚本环境可能对您有用,但我认为它并不完全符合您的要求。

Jython and its derivatives should be able to do this. Jython及其衍生品应该能够做到这一点。 See also Jythondroid . 另见Jythondroid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用javax.script或Rhino在带有浏览器上下文(例如envjs)的Java中运行javascript? - Using javax.script or Rhino to run javascript in Java with browser context (e.g. envjs)? 在哪里放置以及如何获得系统范围的配置数据的正确位置,例如system_home以独立于平台的方式用于Java? - Where to put and how to get a proper location for system wide configuration data e.g. system_home in a platform independent way for Java? Android(Java):左右滑动一次浏览列表(例如RecyclerView) - Android (Java): browsing list (e.g. RecyclerView) by left and right swipe, one by one 跨平台的静态记录器,例如Java(Applet)和Android - Static logger for cross-plattform, e.g. Java (Applet) and Android 如何在Android的Java库中添加资源(例如文本文件) - How to add resources (e.g. a text file) in a Java Library for Android JMH启动脚本->例如,设置Iterations(5) - JMH start script -> e.g. set Iterations(5) Java Path 如何转换为例如 InputStream - How is Java Path converted to e.g. InputStream Java合同检查-内置? 例如,哈希码/等于 - Contract Checking in Java - In Built? E.g. Hashcode/Equals 在Java Servlet中使用静态变量(例如在AppEngine中) - Usage of Static variables in Java Servlets (e.g. in AppEngine) 使用Java regexp匹配(例如)Unicode字母 - Matching (e.g.) a Unicode letter with Java regexps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM