项目中需要引用一个第三方地类库,其中有一个方法,它的参数是Context,不知道我在js是里应该如何传入呢?
下面这句是java中的调法,没问题:
int rtn = SOF_DeviceLib.SOF_LoadLibrary(this, list.get(0), list.get(1), list.get(2), list.get(3));
这个this,在文档中描述的参数类型是android.content.Context,
我在前端的调用方法:
var plusReady=function(){
var Context = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass("com.longmai.security.plugin.SOF_DeviceLib");
var intent=new Intent();
try{
var rtn=intent.SOF_LoadLibrary(Context,'0','mToken TF/SD Card','com.longmai.security.plugin.driver.tf.TFDriver','TFKRSA');
}
catch(e){
document.write(e);
}
}
结果报错:
java.lang.Class java.lang.reflect.Method.getReturnType()' on a null object reference;at com.longmai.security.plugin.SOF_DeviceLib.SOF_LoadLibrary