title: Is ondestroy not always called?
body: <p>I have put some cache cleaning code in <code>onDestroy</code> of my activity but most of the time the code is not executed unless I explicitly finish the activity via <code>finish()</code>.</p>
  
  <p>Edit: Just read <code>onDestroy</code> is called only with <code>finish()</code> or if the system is low on resources. So where do I need to put my cache cleaning code? If I put it in <code>onPause()</code> and the user goes back to the app, the cache is cleared. I am actually storing important temporary files in the cache that should not be deleted in <code>onPause</code>.</p>