user4775313
user4775313

Reputation:

How to create folders in external SD Card on Android 4.4.2?

I've added the permissions to read and write in the manifest file. By default my device has the following folders:

/storage/emulated/0

/storage/emulated/legacy

/storage/sdcard0

/storage/sdcard1

/storage/usbcard1

It turns out that is not being can create folders in /storage/sdcard1, which is the location of the sdcard, with the same method I can create folders in /storage/emulated/0.

This is my method to create folders

private static boolean CriarDiretorio(File dir) {
    if (dir.isDirectory()) return true;  // already exists
    if (dir.exists()) return false;      // already exists, but is not a directory
    return dir.mkdirs();                 // create it
}

Upvotes: 2

Views: 911

Answers (2)

Taz D
Taz D

Reputation: 1

The best way is to root the OS first, then use root explorer. Or to create a folder and the documents with one of those 3rd party file managers to write on in the internal memory card and when finished writing the documents and creating folders, then use the internal file manager that came with Kitkat OS to then copy the created folder and documents to the external SD card. For now this is the only way until a amazing programmer hacker can fix the problem.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006839

You cannot read or write in arbitrary locations on removable storage on Android 4.4+.

You are welcome to call getExternalFilesDirs() (note: plural). If it returns 2+ directories, the second and subsequent ones will be directories on removable storage, unique for your app, that you can can read from and write to.

Upvotes: 0

Related Questions