title: findFragmentByTag() always return null - Android
body: <p>In my application i have one main activity and several fragments. when user click the back button fragments pops one by one. I want to identify which fragment currently in the back stack. So use to identify fragments by fragment tag name. i used following code segment to get fragment tag name but it always returns null value.</p>
  
  <pre><code>FragmentManager fm = MainActivity.this.getSupportFragmentManager();
  String fragmentTag = fm.getBackStackEntryAt(fm.getBackStackEntryCount() - 1).getName();
  </code></pre>
  
  <p>please help.</p>
  
  <p>Edit,</p>
  
  <p>replacing fragment with tag,</p>
  
  <pre><code>FragmentManager fm = MainActivity.this.getSupportFragmentManager();
  FragmentTransaction ft = fm.beginTransaction();
  ft.replace(R.id.activity_main_content_fragment, fragment, text);
  </code></pre>