 <p>Once a program goes out of memory it can be hard for it to recover. You need to think carefully about how to try and clean up when that happens. For example, in your saveImageToExternalStorage, it doesn't clean up the fOut if an exception occurs inside your try/catch. So you should do things like put </p> <pre><code>OutputStream fOut = null; </code></pre> <p>outside the try/catch, and then close it in a finally block of the try/catch. And pay attention to the possibility of further exceptions in the catch of finally blocks.</p>