How to delete internal storage file in android?

I have used the Android internal storage to save a file for my application (using openFileOutput) but I would like to delete that file, is it possible and how?


File dir = getFilesDir();
File file = new File(dir, "my_filename");
boolean deleted = file.delete();

I know this is a bit of an oldie, but the docs say to use:

deleteFile("filename");

rather than:

File.delete();

Which if you are already using:

getFilesDir();

kind of makes sense.