I’m writing an app which must send some files via bluetooth.
A client recieves a byte array which must be then constructed into file. But only a few lines from array are copied into the file!
Here’s my code from thread, where every message from server is read:
Edit: try/catch code.
try {
FileOutputStream fos = new FileOutputStream("//mnt//sdcard//" + fileName);
fos.write(buffer);
fos.close();
}
catch(FileNotFoundException e) {
Log.d("FAIL", e.toString());
}
catch (IOException e) {
Log.d("FAIL", e.toString());
}
Buffer is byte[]. I even checked with Toast: everything is fine with buffer. It contains every symbol from file, but I can’t write it all somehow.
An example that you could try to use is: