开发者

How to delete a file that exists in the SD card in Android?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜