Can not create folder in sdcard

microbox

Active Member
Licensed User
Longtime User
I'm trying to create a folder in my sdcard (4Gb) but failed to do so or I do not know how to("/mnt/Sd card", "TestDirectory")...but when creating in the local memory the following code works..
B4X:
File.MakeDir("/mnt/sdcard/extstorages/sdcard", "TestDirectory")
Can anyone help, and tell me what I'm doing wrong?
My device is MK802 + Android4.0
I attached an image that might be helpful to understand to what I'm trying to do.

Thanks in advance,
microbox
 

Attachments

  • FileManager.jpg
    FileManager.jpg
    64.9 KB · Views: 287

microbox

Active Member
Licensed User
Longtime User
Hi David, thanks for your reply...but still not able to create folder in the sdcard with the suggested code but it creates in the local memory instead(/mnt/sdcard)...:confused:
B4X:
Sub CreateDir
   File.MakeDir(File.DirRootExternal,"TestDirectory")
   Msgbox(File.DirRootExternal ,"")  ' shows "/mnt/sdcard"
   Msgbox("Command executed!","Create Folder 1")
End Sub

Best Regards,
microbox
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
Are you trying to make the folder on a real removable SD card rather than the internal memory? As a hangover from earlier devices which only had SD cards for bulk storage Android regards the internal memory of recent devices as "external memory".

From the Android docs.
Every Android-compatible device supports a shared "external storage" that you can use to save files. This can be a removable storage media (such as an SD card) or an internal (non-removable) storage. Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer.
File.DirExternal refers to this memory, which in your case, judging by your screenshot, is probably the internal memory. If this is the case you need to find the path to the real SD card with a file explorer. As far as I know there is no standardised path for real external SD cards.
 
Upvote 0
Top