Can anybody please explain me how the arguments in invoke method can use correctly.
browserField.extendScriptEngine("interesting.test", new ScriptableFunction() {
public Object invoke(Object thiz, Object[] args) throws Exception {
Dialog.alert("Done");
return super.invoke(thiz, args);
}
});
I have call above method in the HTML file as follow.
<button type="button" onclick="interesting.test()">Display Alert</button>
When I use following code
System.out.println("# thiz : " + thiz.toString());
result is
[0.0] # thiz : net.rim.device.apps.internal.browser.olympia.dom.ScriptObjectShadow@a2f32d2a
and when I use this code
System.out.println("# args : " + args.length);
the result is
[0.0] # args : 0
which prints on the Console.
I have used both those System.out method inside invoke method. Also I have refer the API documentation and still I could not understand how to pass values to those two arguments and retrieve them.
You could try this, it worked for me
and then from html do this
because those arguments are simply array of objects that can mean having more than one parameter at the same time for flexibility purposes, its kind of similar to the arguments that is used in javascript. So try it out...