android - Creating File With String Object -


im writing socket program send , receive strings. im trying build file using received strings sending other side. done text files in others such image file doesn't work , when complete, image not open!

in receiver:

file = new file(dir,filename); fout = new fileoutputstream(file); dos = new dataoutputstream(fout);

and when msg received:

dos.write(msg.getbytes("utf-8"));


in sender:

file file = new file(filepath); inputstream = new fileinputstream(file); inputstreamreader isr = new inputstreamreader(is);

...

isr.read(inputbuffer);

i have tried solution problem didn't fixed:

  • changing utf-8 iso-8859-1

  • using output stream writer instead of data output stream.

  • trying smaller pictures text file.

bytearrayoutputstream useful converting bitmap byte array.
after then, using bitmapfactory, decodebytearray converting byte bitmap.


Comments

Popular posts from this blog

google app engine - 403 Forbidden POST - Flask WTForms -

Android layout hidden on keyboard show -

Parse xml element into list in Python -