Is it programmer responsibility to delete temp file
<p>Currently, I have an application, which will save a temporary screenshot, and let user share it through facebook. The image saving code is more or less as follow.</p>

<pre><code>// Use external cache dir, as our image file is large (&gt;1M)
File outputDir = this.getExternalCacheDir();
File tempFile = File.createTempFile("CHEOK", "CHEOK", outputDir);
// In Desktop's J2SE, this file will automatically be deleted, once my desktop
// application quit. However, this is not the case for Android. My guess is, JVM
// is not terminated, even our Android application had quit.
tempFile.deleteOnExit();
</code></pre>

<p>I realize even I quit my Android application (By pressing system "back" button), the tempFile is still there even we are using <code>deleteOnExit</code>. My guess is that the JVM is not terminated yet.</p>

<p>May I know, is it our application programmer responsibility, to delete the created temp file, during Activity's <code>onDestroy</code>? If not, what is the common best practice?</p>
