I am trying to write a MIDI file on SDcard. It works on my device but not in the emulator. Here's the error on the logCat :
12-25 09:18:27.733: W/ExternalStorage(1951): Error create /sdcard/download/test.mid
12-25 09:18:27.733: W/ExternalStorage(1951): java.io.FileNotFoundException: /sdcard/download/test.mid
12-25 09:18:27.733: W/ExternalStorage(1951): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:244)
12-25 09:18:27.733: W/ExternalStorage(1951): at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
12-25 09:18:27.733: W/ExternalStorage(1951): at java.io.FileOutputStream.<init>(FileOutputStream.java:168)
12-25 09:18:27.733: W/ExternalStorage(1951): at java.io.FileOutputStream.<init>(FileOutputStream.java:147)
I have set the permission in the manifest file, and change the path from "/sdcard/download/test.mid" to Environment.getExternalStorageDirectory()+"/download/test.mid" but still doesn't work.
FYI, I use Kevin Boone's MidiFile class, and here's my code :
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
mf.writeToFile(Environment.getExternalStorageDirectory()+"/download/test.mid");
}