Created
May 1, 2011 15:11
-
-
Save julianshen/950560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initScriptEnv() { | |
jsContext = org.mozilla.javascript.Context.enter(); | |
jsContext.setOptimizationLevel(-1); | |
jsScope = jsContext.initStandardObjects(); | |
Object RObj = org.mozilla.javascript.Context.javaToJS(new Rwrapper(), jsScope); | |
ScriptableObject.putProperty(jsScope, "R", RObj); | |
ScriptableObject.putProperty(jsScope, "log", new Log()); | |
ScriptableObject.putProperty(jsScope, "findview", new FindViewById(this)); | |
InputStream in; | |
try { | |
in = this.getResources().getAssets().open("init.js"); | |
jsContext.evaluateReader(jsScope, new InputStreamReader(in), "init.js", 0, null); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment