androidのサンプルプロジェクトのBluetoothChatについてです
エラーは以下のようなものでした
Multiple markers at this line
- The method invoke(Object, Object...) in the type Method is not applicable for the
arguments ()
- Unhandled exception type IllegalAccessException
- Unhandled exception type InvocationTargetException
以下はソースです。
lang
1 private final BroadcastReceiver mReceiver = new BroadcastReceiver() { 2 @Override 3 public void onReceive(Context context, Intent intent) {
内に、
lang
1 BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 2 BluetoothDevice device = adapter.getRemoteDevice(adapter.getAddress()); 3 Method createBondMethod = BluetoothDevice.class.getMethod("createBond", new Class[]{}); 4 Boolean result = (Boolean)createBondMethod.invoke(); 5 Method convertPinToBytesMethod; 6 convertPinToBytesMethod = BluetoothDevice.class.getMethod("convertPinToBytes", new Class[]{ String.class }); 7 byte[] pinCodes = (byte[])convertPinToBytesMethod.invoke(BluetoothDevice.class, "0000"); 8 Method setPinMethod = device.getClass().getMethod("setPin", new Class[]{ byte[].class }); 9 Boolean results = (Boolean)setPinMethod.invoke(pinCodes);
を書き加えて、自動ペアリングを行おうとしたのですが、
上記のようにエラーが出ます。
どうすればいいでしょうか。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/06/05 01:21