Issue
One of the General changes while porting modules to our current SDK 1.8.0.1 was remove TiContext.
Customer's remarks
Inside my Android module, I have to execute some JavaScript statements in the current context. I was using TiContext to do that in pre-1.8.0.1 versions of SDK. Since TiContext is deprecated where in 1.8.0.1 Android module SDK can I find evalJS() and evalFile() methods?
General changes
{noformat}
TiContext is being replaced, and any implementation utilizing TiContext will take a performance / stability hit compared to using the desired API's directly.
In most of the places where TiContext is used as an argument, the TiContext argument can be removed entirely or replaced with an Activity reference.
{noformat}
evalJS and evalFile methods migrated
public Object evalFile(String filename)
throws IOException
{
return evalFile(filename, null, -1);
}
public Object evalJS(String src)
{
if (krollBridge == null)
{
Log.e(LCAT,"on evalJS, evaluator is null and shouldn't be");
}
return krollBridge.evalJS(src);
}
References
https://wiki.appcelerator.org/display/guides/Android+Module+Porting+Guide+for+1.8.0.1
We need to get some insight into how TiContext evalJS / evalFile are being currently used, as it makes a significant impact on the amount of time it will take us to re-introduce this functionality.
Make sure to run this test for both V8 and Rhino: * Copy the attached module zip into a project and add this to your tiapp.xml:
* Use this code inside the app:
* In the console, you should see these messages printed when the application runs:
Note: This is the java snippet that was used to expose these APIs for the module:
Pull request is ready: https://github.com/appcelerator/titanium_mobile/pull/1538
Tested with 2.0.0.v20120319003254 v8/rhino on Droid 2.2.2 and Emulator 2.3.3. Getting the correct console output