I\'ve used code from BluetoothChat example to send and receive byte data from a Bluetooth Scale. The scale receives the command from the device, then sends back a byte array
Not sure why this is happening, but it may be some weird race condition. One of the problems with your code is that it wants to read all the time data! Even when no data is there.
So maybe you read the first 2 bytes, then a subsequent iteration you read the input buffer again without the first 2 bytes (the debugger shows you the wrong picture in this case).
What you can try to improve is by adding these lines(don't try to copy paste, I am adapting the code to your previous one - it may or may not work):
bytes = mmInStream.getAvailable();
if (bytes>0) {
Log.i("some hardcoded tag", "I am reading " + Integer.toString(bytes) + " bytes");
//you could also print the entire bytearray
/*
Log.i("some hardcoded tag", "The entire array:");
for(int i=0; i
Notice I use Log.i instead of the debugger. It's better for multithreaded stuff if you can implement the logs and they don't bother you - plus it's faster to execute and more easy to debug.