title: How to exit from an android app?
body: <p>I've just read that you can exit an android application by simply calling:</p>
  
  <pre><code>finish();
  </code></pre>
  
  <p>However this is not the case! When I do this I get the following errors:</p>
  
  <pre><code>PackageInstallationReciever Remove /data/local/tmp/com._____.apk Fail!
  AndroidRuntime Uncaught handler: thread main exiting due to uncaught exception
  AndroidRuntime java.lang.NullPointerException
  AndroidRuntime     at android.....
  dalvikvm Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  </code></pre>
  
  <p>So what is the proper way to force an application to exit? For the record, I'm calling it from a menu item but it doesn't seem to matter!</p>