I am creating a file to send as an attachment to an email. Now I want to delete the image after sending the email. Is there a way to delete the file?
I have tried myFile.delete();
but it didn't delete the file.
I'm using this code for Android, so the programming language is Java using the usual Android ways to access the SD card. I am deleting the file in the onActivityResult
method, when an Intent
is returned to the screen after sending an email.
Sorry: There is a mistake in my code before because of the site validation.
I think is clear... First you must to know your file location. Second,,,
Environment.getExternalStorageDirectory()
is a method who gets your app directory. Lastly the class File who handle your file...