문제

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.

도움이 되었습니까?

해결책

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" />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top