How to delete a file from SD card?

File file = new File(selectedFilePath);
boolean deleted = file.delete();

where selectedFilePath is the path of the file you want to delete – for example:

/sdcard/YourCustomDirectory/ExampleFile.mp3

Leave a Comment