Peter Peter - 1 year ago 76
Android Question

Make directory in android

Im trying to build a directory called "images" on the SD card on android. This is my code but its not working? Can anyone give me some advice?

File picDirectory = new File("mnt/sdcard/images");

Answer Source

You want to be sure you are correctly finding the address of your SDCard, you can't be sure its always at any particular address. You will want to do the following!

File directory = new File(Environment.getExternalStorageDirectory()+File.separator+"images");

Let me know if this works for you!

You will also need the following line in your AndroidManifest.xml

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download