0
任何人都可以請我解釋一下invoke
方法中的參數如何正確使用。BlackBerry的對象調用(Object thiz,Object [] args)方法的用法
browserField.extendScriptEngine("interesting.test", new ScriptableFunction() {
public Object invoke(Object thiz, Object[] args) throws Exception {
Dialog.alert("Done");
return super.invoke(thiz, args);
}
});
我在HTML文件中調用上面的方法如下。
<button type="button" onclick="interesting.test()">Display Alert</button>
當我使用以下代碼
System.out.println("# thiz : " + thiz.toString());
結果是
[0.0] # thiz : net.[email protected]a2f32d2a
,當我使用此代碼
System.out.println("# args : " + args.length);
結果是
[0.0] # args : 0
在控制檯上打印。
我已經在invoke方法中使用了這兩個System.out方法。另外我也參考了API文檔,並且仍然無法理解如何將值傳遞給這兩個參數並檢索它們。