1. Download our Official Android App: Forums for Android!

How to delete audio file created using built in sound recorder.

Discussion in 'Introductions' started by KavitaDev, Jun 17, 2011.

  1. KavitaDev

    KavitaDev Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    13
    Joined:
    Jun 17, 2011

    Jun 17, 2011
    13
    0
    35
    Software Engineer
    India
    Hi All,

    I am newbie to this forum and android as well. Sorry for my weak English.

    I am programming for Android 1.5. In my application, I want to record an audio using inbuilt sound recorder. For this, I am starting sound recorder using action -

    "MediaStore.Audio.Media.RECORD_SOUND_ACTION"

    for an Intent. In onActivityResult(), I had copied the newly created audio file to my custom folder e.g. "/sdcard/myRecordings/sound_1.3gpp".

    Now I want to delete the original file created by sound recorder.

    In DDMS view, I had seen that files were created in a folder -

    "/sdcard/recordingXXXX.3gpp"

    I had searched internet, but never found helpful solution for - "how can I delete this file".

    Someone suggested to use ContentResolver to delete file by specifying Uri returned by sound recorder activity. I had done this using -

    oContentResolver.delete(oUri, null, null);

    But only Uri entry is deleted and file remains in the folder mentioned above. One suggestion was to start media scanner activity. I had done this using -
    sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

    I had added appropriate intent filter in manifest file. But, this stops the emulator when I start my application.

    Can anyone give some insight on this? Any help will be greatly appreciated!

    Thanks!
     

    Advertisement

  2. lunatic59

    lunatic59 Moderati ergo sum
    Moderator
    Rank:
     #2
    Points:
    4,238
    Posts:
    36,631
    Joined:
    Jun 12, 2010

    Jun 12, 2010
    36,631
    34,736
    4,238
    Male
    IT
    Pennsylvania
    Welcome to Android Forums!

    Sorry, I don't have any experience with this. Perhaps if you asked your question in the developer sections of the forum somebody who actually knows this stuff will be able to answer you.
     
    KavitaDev likes this.
  3. scary alien

    scary alien not really so scary
    Moderator
    Rank:
     #8
    Points:
    2,138
    Posts:
    22,291
    Joined:
    Mar 5, 2010

    Mar 5, 2010
    22,291
    23,634
    2,138
    Male
    space alien ;)
    Indy
    Welcome to AndroidForums, KavitaDev.

    Sounds like the name of the file that you want to delete (i.e., /sdcard/recordingXXXX.3gpp) might change from one recording to another? If you know the name, you could simply delete the specific file (i.e., new File(<filename>).delete();), but I suspect you already know that ;).

    You might try posting a question or searching the stackoverflow.com site. Its got lots of Java- and Android-specific information over there that someone might have already encountered.

    I'm sure the developer section that lunatic59 posted could benefit from any resolution you eventually find.

    Cheers and glad you signed-up!
     
    KavitaDev likes this.
  4. KavitaDev

    KavitaDev Newbie
    Thread Starter
    Rank:
    None
    Points:
    35
    Posts:
    13
    Joined:
    Jun 17, 2011

    Jun 17, 2011
    13
    0
    35
    Software Engineer
    India
    Hi All,

    Thank you all for your quick reply. I will post new thread in the developer section as suggested.

    Thanks.
     
  5. olbriar

    olbriar  
    Moderator
    Rank:
     #10
    Points:
    2,013
    Posts:
    18,468
    Joined:
    Jun 19, 2010

    Jun 19, 2010
    18,468
    17,666
    2,013
    Male
    Land of Oz
    Welcome to Android Forums. Good luck and have fun.
     

Share This Page

Loading...