Question

I would really like your help in knowing the procedure to delete a .3gp file that has been recorded and stored.

Currently the common file.delete() command does not physically delete the file and we don't even receive an error message displaying why the file deletion was not successful. As per the command it has been executed successfully but the file is remaining intact in the external storage directory.

Can anyone help me with some explanation why this is happening and a solution to solve this issue.

Awaiting your early replies.

Was it helpful?

Solution

simply

File file = new File(filePath);

    try                                    
    {

      if(file.exists())
      {
         file.delete();
      } 


    }

    catch (IOException e) 
    {
       e.printStackTrace();
    }

dont forget to add permissions in manifest

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top