Fragment found in backstack after FragmentTransaction.remove()
<p>I have 2 fragments and 1 activity.</p>

<p>I am calling to remove the 2nd fragment from the 1st fragment via the activity like this:</p>

<p>Fragment 1:</p>

<pre><code>FragmentManager manager = getActivity().getSupportFragmentManager();
if(manager.findFragmentByTag("AdFragment") != null){
      manager.beginTransaction().remove(manager.findFragmentByTag("AdFragment")).commit();
      Log.d("BACK", "Removed AdFragment");
}
</code></pre>

<p>Now when I do back press my onBackPressed method in the activity still finds the just removed 2nd fragment:</p>

<p>Activity:</p>

<pre><code>@Override
public void onBackPressed() {
    FragmentManager manager = getSupportFragmentManager();
    AdFragment adFrag = (AdFragment) manager.findFragmentByTag("AdFragment");
    if(adFrag != null){
        Log.d("BACK", "Found AdFragment from backstack");
    }
}
</code></pre>

<p>The AdFragment is found even when I remove the fragment in Fragment 1. What am I misunderstanding?
Thanks!</p>

<p>Here is the moment is start the 2nd fragment from the activity:</p>

<pre><code> public void openAdFragment(View v){
    final AdFragment adFragment = new AdFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(R.id.adFragmentContainer, adFragment, "AdFragment").addToBackStack("AdFragment").commit();
}
</code></pre>

<p>Here is the code for starting the first fragment:</p>

<pre><code> android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, buildingFragment, "BUILDINGPAGE");
</code></pre>