title: Fragment pressing back button
body: <p>I am now having an activity containing fragments </p>
  
  <p>[1] , [2] , [3] , [4] </p>
  
  <p>If pressing buttons , [3]  , it can be redirected to [4]</p>
  
  <p>I would like to implement the back button as shown follow..</p>
  
  <p>when pressing back  at [4] , it return to [3]</p>
  
  <p>when pressing back  at [3] , it return to [2]</p>
  
  <p>when pressing back  at [1] , the activity finishes();</p>
  
  <p>When it comes to the current implementation, it finish the activity instead of popping up the Fragment. Would you please tell me what I should do or keep in mind ? </p>
  
  <pre><code>@Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
  
      if( keyCode==KeyEvent.KEYCODE_BACK) 
      {   
  
          finish();
      }       
  
          return super.onKeyDown(keyCode, event); 
  
  }   
  </code></pre>