BJP wrote: > I would like to write a file to the SD card from my application, but > the following code throws an IOException when debugged on a T-Mobile > G1: > > String p = Environment.getExternalStorageDirectory() + "/log.txt"; > File recfile = new File(p); > recfile.createNewFile(); > > The last line throws an IOException with detailMessage = "Cannot > create: /sdcard/log.txt". The MOUNT_UNMOUNT_FILESYSTEMS permission is > set in the manifest. And yes, I really do want to write to the SD > card; I don't want to use the logging features Android includes for > this particular application. The Android documentation does not seem > to give any specifics on how one might write files to removable > storage in "Data Storage" under "Framework Topics". What am I doing > wrong, or where can I read more about this topic?
If you are running this on the emulator, do you have an SD card image set up? The emulator does not have SD card storage by default -- you need to use mksdcard to create an image and then tell the emulator to use that image via a command-line switch at startup. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

