I cannot create directories and files on sd card.
-------------------------------
This is the simple example:
-------------------------------
File sdcard = android.os.Environment.getExternalStorageDirectory();
File dir = new File(sdcard, "data/com.samples.fileio/");
Log.d("FileIOTest", "Directory: "+dir);
if(!dir.exists()) {
Log.w("FileIOTest", "Directory does not exists");
if(!dir.mkdirs())
Log.e("FileIOTest", "Cannot create directories");
else
Log.d("FileIOTest", "Directory created");
}
-------------------------------
Log output:
-------------------------------
09-15 22:27:23.634: DEBUG/FileIOTest(5049): Directory: /sdcard/data/
com.samples.fileio
09-15 22:27:23.634: WARN/FileIOTest(5049): Directory does not exists
09-15 22:27:23.634: ERROR/FileIOTest(5049): Cannot create directories
-------------------------------
Directory /sdcard/data exists and has 'd---rwxr-x' permissions (both).
Why mkdirs() fails?
--
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