I seem to be facing this weird error on a socket.connect():
09-18 14:41:22.968: W/System.err(2593): java.lang.NullPointerException
09-18 14:41:22.968: W/Syst
I had the same problem with the Galaxy tab 2 and I solved with:
BluetoothSocket tmp = null;
try {
tmp = device.createRfcommSocketToServiceRecord(SPP_UUID);
// for others devices its works with:
// Method m = device.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
// for galaxy tab 2 with:
Method m = device.getClass().getMethod("createInsecureRfcommSocket", new Class[] {int.class});
tmp = (BluetoothSocket) m.invoke(device, 1);
} catch (IOException e) {
Log.e(TAG, "failed! error: " + e.getMessage());
}
socket = tmp;
socket.connect();
Log.i(TAG, "Client Connected!");
Hope this helps =D