I'm adding a Fragment
to my Activity
like this:
getSupportFragmentManager()
.beginTransaction()
.add(R.id.frame_container, fragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(fragment.getClass().getName())
.commit();
But when I want to find the Fragment
using a FragmentManager
it's returning null:
Fragment oldFragment = (Fragment) getSupportFragmentManager().findFragmentByTag(fragment.getClass().getName());