title: Prevent Back button from closing my application
body: <p>I am using the following code in my application's activity to prevent it from closing my app on back.</p>
  
  <pre><code>/* Prevent app from being killed on back */
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
  
          // Back?
          if (keyCode == KeyEvent.KEYCODE_BACK) {
              // Back
              moveTaskToBack(true);
          }
  
          // Return
          return super.onKeyDown(keyCode, event);
  
      }
  </code></pre>
  
  <p>It does not work.  The app is set to be Android 1.6 (API Level 4) compatible.  Clicking on my application icon restarts my app at a Splash activity (which is the Main).  How can I prevent my app from closing on back?</p>