Deleting files created with FileOutputStream

Viewed 30085

I'm developing for the Android platform.
My app creates a temp file with a simple call to:

FileOutputStream fos = openFileOutput("MY_TEMP.TXT", Mode);

It works fine because I can write to it and read it normally.

The problem is that when I exit from the app I want to delete this file. I used:

File f = new File(System.getProperty("user.dir"), "MY_TEMP.TXT");
f.delete()

But it always returns false and the file is not deleted.
I have tried:

File f = new File("MY_TEMP.TXT");
f.delete();

And it does not work either.

5 Answers
Related