我正在像这样添加Fragment
一个Activity
:
getSupportFragmentManager()
.beginTransaction()
.add(R.id.frame_container, fragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(fragment.getClass().getName())
.commit();
但是当我想找到Fragment
using aFragmentManager
时,它返回 null:
Fragment oldFragment = (Fragment) getSupportFragmentManager().findFragmentByTag(fragment.getClass().getName());