I created a program that sends files by email. I want to erase the image file after sending the email. Is there a way to erase the file?
myFile.delete();
I tried it like this, but the file doesn't erase.
For your information, I also allowed access to the SD card.
File file = new File;
boolean deleted = file.delete();
You have to do it like this. And the path to the file you want to erase must be the absolute path, as shown in the example below.
/sdcard/YourCustomDirectory/ExampleFile.mp3
© 2024 OneMinuteCode. All rights reserved.