是否可以将 SL4A 脚本存储在本地数据库中并从 java Activity.class 中运行它们?
我正在考虑一个想法,将 SL4A 代码脚本片段存储在“常规”java Android 应用程序的本地数据库中。这个想法是在运行时从 Activity 类中检索这些代码片段并执行它们。
尽管我用了最好的谷歌搜索,但我还是找不到任何例子,这对我来说是一个坏兆头。有很多关于如何运行 SL4A 脚本的示例,但似乎没有一个示例显示如何将脚本作为字符串(或流)对象检索,然后从活动中执行脚本。
我确实找到了一个接近我想要的示例,但它似乎没有提供执行多行脚本的能力,并且需要 root 访问权限。
I'm toying around with an idea in which I store SL4A code script snippets inside a db local to a "regular" java Android app. The idea is to retrieve those code snippets from within an Activity class at run time and execute them.
I haven't been able to find any examples despite my best google-fu, which strikes me as a bad sign. Plenty of examples on how to run SL4A scripts, but none that seem to show an example of how to retrieve a script as a String(or stream) object and then execute the script from within an Activity.
I did find one example that was close to what I want, but it didn't seem to offer the ability to execute multiple lines of script and it required root access.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从数据库中检索脚本内容,然后将其写入文件,最后调用 SL4A 来运行它?一个用 Python 语言编写的例子:
祝你好运!
You could retrieve the script contents from your DB and then write it to a file, finally calling for SL4A to run it? An example in a made up / Python-y language:
Good luck!