Accessing Files in the Raw folder in Android
<p>I am working on an exporting function in an Android application. The files are wav files which are stored in the res/raw folder. How can I access the files?</p>

<pre><code>uri = Uri.parse("android.resource://" + getPackageName() + "/raw/" + selection[i]);


            try{
                file[i] = new File(uri.getPath());
                if(file[i].exists()){
                    Log.i("EXIST", "EXIST");
                }else{
                    Log.i("EXIST", "NOT");
                }

            }
            catch(Exception e){
                Log.i("ERROR", "File Not Found");
            }
</code></pre>

<p>selection[i] is the filename of the file that I need in the res/raw folder. The code always returns "NOT", which means it has not found the file that I want from the res/raw folder. Can anyone help me please? Thanks.</p>