Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a directory in Internal memory (Root Folder)

Tags:

android

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 have 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.

like image 458
Rahul Kalidindi Avatar asked Dec 08 '25 09:12

Rahul Kalidindi


1 Answers

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

like image 196
CommonsWare Avatar answered Dec 09 '25 22:12

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!