Java代码:
Method m = mBluetoothDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
bluetoothSocket = (BluetoothSocket) m.invoke(mBluetoothDevice, 1);
Native.js代码:
var Method=plus.android.importClass('java.lang.reflect.Method');
var m=new Method();
var Class=plus.android.importClass('java.lang.Class');
var cla=new Class[] { int.class };//如何转换成Natvie.js支持的InstanceObject
m=BluetoothDevice.getMethod("createRfcommSocket", cla);
bluetoothSocket=m.invoke(device,1);
报错:
在var cla=new Class[] { int.class };语句处报错: Uncaught SyntaxError: Unexpected token ]
3 个回复
app学 - 跟着项目走
这个有解决嘛?
jwy
同问!!
f***@qq.com
同问