I am working on Bluetooth Application on Android. This inputStream is from connection socket. I want to read bytes upto certain length.
First way I tried :
byte[] data = new byte[lengthtoread];
for (int i = 0; i < data.length; i++)
data[i] =(byte) mmInStream.read() ;
I have found that it is been too slow.
Sencond way:
byte[] data = new byte[lengthtoread];
mmInStream.read(data, 0, lengthtoread);
In this I found that its not reading data completely when length to read is too large
Anyone please help me out ??