Q:

File not found in external sd

I am trying to read an audio file that I have previously saved on my external storage but it seems that I cannot find it with the methods that I am using.
This is what I use in order to save the file in the external sdcard;
outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ejemplo.3gpp";

And this is what I use in order to get back the byteArray of the audio file recorded:
InputStream is =this.openFileInput("/sdcard/ejemplo.3gpp"); 
bytes = IOUtils.toByteArray(is);

For some reason, it seems that when I call openFileInput is not able to find the file, but with "Root browser" I have checked that actually the file is placed in "/sdcard/ejemplo.3gpp" so I dont know what is going on .... Any suggestions?

A:

/sdcard/ is not default. It can be changed by OEM and in some devices it is sdcard0 So use the Environment class as you use it to save the file.
File file = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + "/ejemplo.3gpp");
InputStream is = new FileInputStream(file);
bytes = IOUtils.toByteArray(is);

