Write to file in android from input stream?
<p>Im getting an input stream, which is an mp3 in my raw folder, and then I am trying to write it back to the raw folder (I know this sounds stupid but I want to do it), but I get an error - file not found, myFile.mp3. Any ideas where I am going wrong?</p>

<pre><code>try
        {
          File f=new File("android.resource//com.apps/raw/myFile.mp3");
          InputStream myRawResource = context.getActivity().getResources().openRawResource(mp3ID); 
          OutputStream out=new FileOutputStream(f);
          byte buf[]=new byte[1024];
          int len;
          while((len=myRawResource.read(buf))&gt;0)
          out.write(buf,0,len);
          out.close();
          myRawResource.close();
    }
          catch (IOException e){    
              //error
              }
</code></pre>
