title: Fragment lifecycle - which method is called upon show / hide?
body: <p>I am using the following method to switch between Fragments (in my NavigationDrawer) by showing / hiding them.</p>
  
  <pre><code>protected void showFragment(int container, Fragment fragment, String tag, String lastTag, boolean addToBackStack ) {
  
          FragmentManager fragmentManager = getSupportFragmentManager();
          FragmentTransaction transaction = fragmentManager.beginTransaction();
  
          if ( lastTag != null &amp;&amp; !lastTag.equals("")) {
              Fragment lastFragment = fragmentManager.findFragmentByTag( lastTag );
              if ( lastFragment != null ) {
                  transaction.hide( lastFragment );
              }
          }
  
          if ( fragment.isAdded() ) {
              transaction.show( fragment );
          }
          else {
              transaction.add( container, fragment, tag );
          }
  
          if ( addToBackStack ) {
              transaction.addToBackStack( tag );
          }
  
          transaction.commit();
  
          // set the active tag
          activeFragTag = tag;
      }
  </code></pre>
  
  <p><strong>What I am unclear about is which method of the Fragments lifecycle is called when I show or hide it?</strong> (since there is no method such as onShow() or onHide() im not quite sure what to use). I want to perform specific actions upon showing and hiding a certain Fragment.</p>