android - Saved Bitmap doesn't appear on SD Card -


i working on app in save bitmaps sd card. have looked @ lot of examples , other questions, , have made following code:

bytearrayoutputstream bytearrayoutputstream = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.jpeg, 100, bytearrayoutputstream); string dirpath = environment.getexternalstoragedirectory().tostring() + "/myfolder"; file dir = new file(dirpath); dir.mkdirs(); string filename = "bitmapname.jpg"; file file = new file(dirpath, filename); fileoutputstream fileoutputstream; try {     boolean created = file.createnewfile();     log.d("checks", "file created: " + created);     fileoutputstream = new fileoutputstream(file);     fileoutputstream.write(bytearrayoutputstream.tobytearray());     fileoutputstream.close(); } catch (filenotfoundexception e) {     log.d("checks", "filenotfoundexception");     e.printstacktrace(); } catch (ioexception e) {     log.d("checks", "ioexception");     log.d("checks", e.getmessage());     e.printstacktrace(); } 

i don't see what's wrong code. doesn't give errors , app runs without crashing. however, when connect phone computer , open sd card not see folder "myfolder" , can not find saved image anywhere. guys have ideas why is?

edit: noticed can see saved bitmaps in android gallery, , indeed in folder called "myfolder". however, still don't see them when connect phone computer , browse sd card.

from experience had similar issued when forgot fileoutputstream.flush(); before close().


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -