android - SD-Card-> Missing value -
really need help. 1 week i'am trying save (raw-)data(-bytes) correctly sd-card of android phone.
the mobile data via bluetooth microcontroller. data printed out correctly terminal, java-code incorrect.
for testing this, variable (8bit) incrementing , after step value of variable sending phone. when read out created file hex-view, there lot of zeros between guilty values ( in case: µc not sending anything) , reason there lot of values missing / maybe chronology wrong.
the saving part:
h=new handler() { public void handlemessage (android.os.message msg) { switch (msg.what) { case recieve_message: byte[] readbuf = (byte[]) msg.obj; string path = "/sdcard/" + dateipfad.gettext().tostring() + ".txt"; environment.getexternalstoragedirectory().getpath(); try { file myfile = new file(path); myfile.createnewfile(); fileoutputstream fout = new fileoutputstream(myfile,true); fout.write(readbuf); fout.flush(); fout.close(); } catch (exception e) { toast.maketext(getbasecontext(), e.getmessage(), toast.length_short).show(); } break; } } };
`
you're not extracting data out of message.
msg.getdata.getbytearray("keyofthemessage")
;
Comments
Post a Comment