Tutorial :Writing to SDCARD problem in Android?



Question:

When implementing download function it work but during file saving to sdcard i get the following

Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.

Also IO Exception occure

W(14495:0x389f) java.io.FileNotFoundException: /sdcard W(14495:0x389f) at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:244) W(14495:0x389f) at java.io.FileOutputStream.(FileOutputStream.java:97) W(14495:0x389f) at java.io.FileOutputStream.(FileOutputStream.java:168) W(14495:0x389f) at java.io.FileOutputStream.(FileOutputStream.java:147)


Solution:1

First make sure you get the File object by calling

File dir = Environment.getExternalStorageDirectory();  

Also if you app is using 1.6+ you will need the WRITE_EXTERNAL_STORAGE permission. If that doesn't help, post the code.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »