When i move a file from raw folder to SD card in android, the file won't move
<p>I used the following code to move the audio file form <code>res/raw</code> folder to SD card, when i execute this code, the file won't move. why it will happens, in which line i made mistake.</p>

<p><strong>MoveAudio.java</strong></p>

<pre><code>public class MoveAudioextends Activity {

    /** Called when the activity is first created. */

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button a = (Button) findViewById(R.id.Button01);

        a.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                byte[] buffer = null;
                InputStream fIn = getBaseContext().getResources()
                        .openRawResource(R.raw.song);
                int size = 0;
                System.out.println("&lt;&lt;&lt;&lt;&lt;&lt;&lt;SIZE&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + fIn);
                try {
                    size = fIn.available();
                    System.out
                            .println("&lt;&lt;&lt;&lt;&lt;&lt;&lt;SIZE&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + size);
                    buffer = new byte[size];
                    fIn.read(buffer);
                    fIn.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block

                }
                String path = "/sdcard/media/audio/ringtones/";
                String filename = "examplefile" + ".ogg";

                boolean exists = (new File(path)).exists();
                if (!exists) {
                    System.out
                            .println("&lt;&lt;&lt;&lt;&lt;&lt;&lt;FALSE SO INSIDE THE CONDITION&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;");
                    new File(path).mkdirs();
                }

                FileOutputStream save;
                try {
                    save = new FileOutputStream(path + filename);
                    System.out
                            .println("&lt;&lt;&lt;&lt;&lt;&lt;&lt;SAVE&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + save);
                    save.write(buffer);
                    save.flush();
                    save.close();
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block

                } catch (IOException e) {
                    // TODO Auto-generated catch block

                }
                sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
                        Uri.parse("file://" + path + filename)));

                File k = new File(path, filename);
                System.out.println("&lt;&lt;&lt;&lt;&lt;&lt;&lt;SAVE&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + k);
            }
        });

    }

}
</code></pre>

<p>In my xml file i had sing button, when i click that button the file will move. This code executes without error but the file won't move.</p>
