开发者

Creating a directory in Internal memory (Root Folder)

I am trying to create a Directory in the internal memory of the device...

I have done like this ...

File testDir = new File(Environment.getRootDirectory(),"Sample");
    testDir.mkdir();

But i cant see a folder created in the file explorer of DDMS when i run it in the emulator. I ha开发者_如何学JAVAve also added

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

to the manifest file. Is anything else to be added... Is this the right way? If no plz suggest me the correct procedure.


You cannot write to the root of internal storage from an SDK application.


The only possibility to write in any folder you want in the internal sotrage would be to have a rooted phone. Moreover, it is a very bad idea to do so. Why do you want to do that ?

EDIT : Ok, read your comment above. I'd then advise you to read the storage doc on Android official site, which will tell you how to save your file in the internal memory.


You can use getDir() function for opening(if exists) or creating directory.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜