title: How to delete audio file created using built in sound recorder
body: <p>I am newbie to this forum and android as well. Sorry for my weak English.</p>
  
  <p>I am programming for Android 1.5. In my application, I want to record an audio using built-in sound recorder. For this, I am starting a sound recorder using action -</p>
  
  <pre><code>"MediaStore.Audio.Media.RECORD_SOUND_ACTION"
  </code></pre>
  
  <p>for an Intent. In <code>onActivityResult()</code>, I had copied the newly created audio file to my custom folder e.g. <code>/sdcard/myRecordings/sound_1.3gpp</code>.</p>
  
  <p>Now I want to delete the original file created by sound recorder.</p>
  
  <p>In DDMS view, I had seen that files were created in a folder -</p>
  
  <pre><code>"/sdcard/recordingXXXX.3gpp"
  </code></pre>
  
  <p>The file name contains XXXX; these are digits that will change every time whenever I am recording audio using sound recorder. I have searched the Internet, but have never found a helpful solution for - "how can I delete this file?" or "how can I get the location of these files programmatically?" (as I am viewing them in DDMS view)</p>
  
  <p>Someone suggested to use <code>ContentResolver</code> to delete file by specifying the Uri returned by sound recorder activity. I had done this using -</p>
  
  <pre><code>ContentResolver oContentResolver = getContentResolver();
  oContentResolver.delete(oUri, null, null);
  </code></pre>
  
  <p>But only the Uri entry is deleted and the file remains in the folder mentioned above. One suggestion was to start media scanner activity. I had done this using -</p>
  
  <pre><code>sendBroadcast(new Intent(
        Intent.ACTION_MEDIA_MOUNTED, 
        Uri.parse("file://" + Environment.getExternalStorageDirectory())));
  </code></pre>
  
  <p>I have added the appropriate intent filter in manifest file, but this stops the emulator when I start my application.</p>
  
  <p>Can anyone give some insight on this? Any help will be greatly appreciated!</p>
  
  <p>Thanks! </p>