lundi 16 février 2015

Open a file audio in R.Raw

I have to open a file that in the /res/raw/ folder, but it seems tha android, doesn't reccognize the path. Here is my code:



public static void openRec()
{
//this is the wav file that I have to analyze
File file = new File("/res/raw/chirp.wav");

try {
FileInputStream in = new FileInputStream(file);
chirp = new byte[(int) file.length()];
in.read(chirp);


Log.d("xxx", "" + chirp.length);
in.close();


} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

}

Aucun commentaire:

Enregistrer un commentaire