create visible folder sdcard, Android

137 views Asked by At

I'm developping an application where I need to create new folders/files in the sdcard. The thing is I can see them using a root explorer but not with the default one which comes with Android.

I've taken a look at several similar questions here but don't seem to work for me.

For sure, I'm using in my manifest this:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and I'm writing all the Files using:

String path = Environment.getExternalStorageDirectory() + "/FolderName/FileName.format"

but as I said, these new folders/files remained hidden and can only be seen using a root explorer. Neither the folder nor file name starts with "."

Thanks in advance.

1

There are 1 answers

1
Smalesy On

Try using mkDirs()

    File dir = new File(fullPath);
    if (!dir.exists()) {
        dir.mkdirs();
    }