Which can be (should be) done with another method from the same android.os.Environment class, namely, getExternalStorageState(). Hence the sample code at http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29 using both.
On Jul 16, 8:54 am, Mark Murphy <mmur...@commonsware.com> wrote: > On Fri, Jul 16, 2010 at 11:28 AM, Arun <arun.tripa...@gmail.com> wrote: > > I have an application that needs to write few logs files into the > > SDCARD. It used to work fine in Donut and Éclair builds, however, when > > tried on Frayo build it didn’t work. > > > The File.mkdir(“/sdcard/file.txt”) API fails in the Java layer > > returning false. > > Never hard-wire paths like that -- use > Environment.getExternalStorageDir(). You don't need to make that > directory, since it already exists, so delete the mkdir() call. > > Also, make sure your Android 2.2 environment has an SD card (image if > you are running this in the emulator). > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en