2

I am getting

java.io.FileNotFoundException: /sdcard/Img_1316563834614.jpg (Permission denied)

after trying

mRAF = new RandomAccessFile(mFullPath, "rws");

where mFullPath was /sdcard/image6456.jpg, /mnt/sdcard/image3579.jpg, file:///sdcard/image34567.jpg, etc. Nothing works. There is already an

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

line in AndroidManifest.xml

I have checked that the path /mnt/sdcard is actually there. Also the call

getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);

gives out null. I should not wonder though...

What am I missing ?

Thanks

kellogs
  • 2,837
  • 3
  • 38
  • 51
  • Are you able to try it on a device? I have found emulator testing to be shoddy at best. – FoamyGuy Sep 21 '11 at 00:18
  • Well, unfortunately it would be cumbersome to test it on a device in my setup – kellogs Sep 21 '11 at 00:45
  • Could you explain what are you trying to do? And why are you dealing with both `/sdcard` and `/mnt/sdcard` If you want the external storage directory you can easily access to with: `getExternalStorageDirectory ()` method which will return the right absolute path of the sdcard, avoiding trouble. Have a look here for more if not yet [Environnement](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()) – San Francesco Sep 21 '11 at 00:49

1 Answers1

5

The emulator does not come with external storage, unless you define some in the AVD. See the "SD Card" group box in the Add Android Virtual Device or Edit Android Virtual Device dialogs:

enter image description here

In this one, I defined 32MB of external storage. By default, the Size field is blank, meaning no external storage.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491