title: clear bundle when back button pressed
body: <p>I use fragments (ListFragment) in an activity and i save the selected item to restore it when the screen rotates.</p>
  
  <pre><code>@Override
      public void onSaveInstanceState(Bundle outState) {
          super.onSaveInstanceState(outState);
          outState.putInt("currentListIndex", mCurrentSelectedItemIndex);
      }
  </code></pre>
  
  <p>When the user clicks on "back" I don't want to save the item selection. I need to override the back button and clear the bundle instance passed to my activity.</p>
  
  <p>I don't really know how to get the bundle instance, I've tried to use a global var but when I use it i have a NullPointerException.</p>
  
  <p>Here is how i do :</p>
  
  <pre><code>private Bundle bundle;
  
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.getRepeatCount() == 0) {
          bundle.clear();
      } 
  
      return super.onKeyDown(keyCode, event);
  }
  </code></pre>
  
  <p>Where can i retrieve the information I want (currentListIndex):
  in the onCreate() of my activity / onCreateView() of my detail fragment ?</p>