I'm trying to delete a file that I earlier created in my android app. The problem I'm having is that the file won't go away. Even though everything seems to work.
I've looked at several post here on stackoverflow, but still not solution. The garbage collections was one of the hints I've found.
System.gc();
System.out.println("Exists: "+file.exists());
System.out.println("Read: "+file.canRead());
System.out.println("Write: "+file.canWrite());
System.out.println("Deleting: " + file);
boolean r = file.delete();
System.out.println("Result of deletion: "+r);
System.gc();
And the result in the log
Exists: true
Read: true
Write: true
Deleting: data/data/no.ntnu.kpro.app/files/kprothales/XOMessage/8
Result of deletion: true
Does anyone have any idea as to why it isn't removed?
EDIT: Lucifer: Yeah, I have set WRITE_EXTERNAL_STORAGE permission in the manifest. ShineDown: No, it is just a file without an extension. For now it is containing xml, but this is going to change over time, hence why I have not called it .xml. Could this be a problem? chintan khetiya: I believe this line is allready included in the code above.