for the code above i get the result in the wrong sequence
return returnBuffer
Haha, Device Found = Device A
But the expected output should be in the following sequence
Haha, Device Found = Device A
return returnBuffer
This is because the hardware response is quite slow, it takes around 2-3 seconds before the listener receive the data.
in order forcing to get the expected result, yes! by adding "Thread.sleep(3000)" before the return statement, but i know this is incorrect and worst coding.
What should i add in the code to make sure the "return" statement executed only after the "listener" receive all the data. Kindly need your help.
Thanks in advanced. your help is much appreciated