0

Android : What I'm trying to say is, let's say I have an app that has the following function

public void FetchCodeAndRun()
{
  ConnectToDatabase();
  String code = FetchCode();
  ExecuteJava(code);
}

I'm in need of this method because I would like to modify pieces of code of an app just by changing code in a database

Any help or any other innovative solution to achive this is appreciated. Thanks in advance :)

Aravind Balaji
  • 57
  • 2
  • 10

2 Answers2

0

First: I think your design by changing code in database is not very good. And I don't recommend it. However It is possible to execute String as code.

@see this: Run piece of code contained in a String

Pavol Loffay
  • 241
  • 3
  • 8
0

Probably what you are looking for is BeanShell: http://www.beanshell.org/manual/embeddedmode.html

You need to add a bsh-core.jar in your /lib folder and instantiate Interpreter object which handles the interpretation of the code you will provide to it.

Here is a guide to do that: http://www.androidguys.com/2008/08/06/scripting-your-android-device/

Pooya
  • 6,083
  • 3
  • 23
  • 43