I tried these codes to delete a wav file in the sd card from android
File file = new File("/sdcard/AutoInsurance_Toolkit/AudioRecorder/1311531953080开发者_StackOverflow中文版.wav");
boolean deleted = file.delete();
and also in the manifest used the permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">
Please tell me am I missing something here because each time the code gets executed successfully but not deleting the content in SD card?
Your code will work assuming you have the WRITE_EXTERNAL permission, the path is correct and the file permission is WORLD_WRITABLE. I'm betting the file was not created as world writable so unless your software created the file you won't be able to delete it.
精彩评论