Can android execute string as code?

So basically, I would like my application to read information from the database, this information will be a string that is valid Java code. After reading, I would like my application to execute this line as if it were code. Are there any features packaged in sdk for Android that support this?

In fact, I want the phone to fill in some data with the requested information from the database. One of these pieces of information will look like this:

"return data.ZombieKillTotal >= 100000;"

which will be used inside the operator, for example:

registerAchievement(new Achievement("Zombie Killer", new AchievementValidator() { 
    public boolean isSatisfied(Data data) { ExecStringAsCode(query result) } 
    });

I just don't know what to use for "ExecStringAsCode" :(

+3
source share
3

Java .

script (, Python) .

0

, , somthing COdeDOM , , .

0

Source: https://habr.com/ru/post/1761364/


All Articles