title: Trying avoid add same fragment twice to backStack, popBackStackImmediate always return false
body: <p>I'm trying avoid adding the same fragment to backStack with this method:</p>
  
  <pre><code>public static void replaceFragment(FragmentManager fragmentManager, Fragment fragment, Boolean addToBackStack) {
          String backStateName = fragment.getClass().getName();
          boolean fragmentPopped = fragmentManager.popBackStackImmediate(backStateName, 0);
  
          if (addToBackStack &amp;&amp; !fragmentPopped &amp;&amp; fragmentManager.findFragmentByTag(backStateName) == null) {
              fragmentManager
                      .beginTransaction()
  //                    .setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right, android.R.anim.fade_in, android.R.anim.fade_out)
                      .replace(R.id.container, fragment)
                      .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
                      .addToBackStack(backStateName) // was 'backStateName'
                      .commit();
          } else {
              if (!addToBackStack)
                  fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
              fragmentManager
                      .beginTransaction()
  //                    .setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right, android.R.anim.fade_in, android.R.anim.fade_out)
                      .replace(R.id.container, fragment)
                      .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
                      .disallowAddToBackStack()
                      .commit();
          }
      }
  </code></pre>
  
  <p>Navigation Drawer contains: ImageView with <code>profilePhoto</code> which opens <code>ProfileMainFragment</code> and few categories which opens <code>MainFragmentCategory</code>. <code>Boolean addToBackStack</code> is <code>false</code> when fragment is choosen from <code>navigationDrawerMenu</code> and <code>true</code> when is choosen within fragment (move from <code>MainFragmentCategory</code> to <code>DetialFragmentCategory</code>) or click <code>profilePhoto</code> in <code>navigationDrawer</code>.</p>
  
  <p><code>fragmentPopped</code> is always <code>false</code>, why is that so? Even if I click <code>profilePhoto</code> and again <code>profilePhoto</code> in <code>navigationDrawer</code>. It should avoid to add it to backStack for a second (and third, and fourth...) time, but it didn't.</p>
  
  <p>Any idea how can I make it right?</p>