I've written a few bluetooth apps now, but I had never seen this particular approach until recently. In the example they use device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
which seems to me a long way of just saying BluetoothSocket bs = createRfcommSocket(...
.
What is the difference between their approach
Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
and mine
sock = createRfcommSocket(.....
Is there a reason to use one or the other?
Thank you