Yea, I checked the SD card and there was a file there, I remove it and also moved the mkdirs up to the second File, now works fine. Thanks for the tip on closing the file too.
On Feb 7, 5:10 pm, David Given <[email protected]> wrote: > Tane Piper wrote: > > [...] > > > File k = new File(j, rowId + ".jpg"); > > k.mkdirs(); > > k.createNewFile(); > [...] > > However, it keeps failing on the line k.createNewFile(); with the > > error: > > WARN/System.err(10727): java.io.IOException: Parent of file is not a > > directory: /sdcard/twitcast/1.jpg > > It looks like there's a file on your SD card called '/sdcard/twitcast' > that's preventing the directory from being created. Is File.mkdirs() > returning non-zero? (Remember that it doesn't throw an IOException on > error.) > > Also, in the interests of pedantry, it's a good idea to close your > FileOutputStream after use --- while the garbage collector will take > care of it *eventually*, leaving the file open may cause you problems > later if you need to open the file again. > > -- > ┌─── dg@cowlark.com ─────http://www.cowlark.com───── > │ "A line dancer near a graduated cylinder, the blithe spirit inside > │ some wheelbarrow, and a tomato are what made America great!" --- > │ received via spam > > signature.asc > < 1KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

