开发者

Can i create folder on Android internal storage?

Assume I'm dealing with a text editor application.开发者_StackOverflow社区 I want to store created text files on a folder which will be in the phone or sdcard (from user choice). I just want to save files onto a folder on internal storage(phone). Am i able to create a folder on android internal storage from code and copy these files there? A folder which will not be private to my application or store under "/data/data/MyapplicationPackage/" and witch from the user could access(read)? Any hint? Thanks.


To satisfy your requirement you can either:

  1. Have your app's files and folders stored on external storage (SD card).
  2. Provide some sort of 'export' feature letting users export their files and folders (possibly bundled in a zip file). If you use the ACTION_SEND you can let them send the exported files by email, save to Dropbox, etc. practically for free.
  3. Make your data available via a ContentProvider to hide the actual storage mechanism. Depending on the type of data, you might want to control access to that provider.


As far as I know, you can, but it does not meet your criteria. It will be private, stored under /data/data/..., and will not be user accessible except via the application. That is unless the user is rooted.


Take a look in here. You have many options to do that, and all depends on mounted names on your device. See APIs getDir() to create a filepath for a private file.

Check also in which path the audio recorder application is writing its files, that solved for me since I could'nt get any private file working for lack of permitions.

You can always enter ADB in console mode, with "adb shell" and run a linux "mount" command to see all your mounted files, you'll need root access though.


I also was facing same problem. I wanted to create a folder in Internal Memory. I tried many code provided in stackoverflow itself. But non of those worked properly. So at last I gave the root directory own my own.

File newFolder = new File("/storage/emulated/0/", "Folder_Name");

This code worked absolutely fine for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜