/** * 递归调用,对所有子Fragement生效 * * @param frag * @param requestCode * @param resultCode * @param data */ private void handleResult(Fragment frag, int requestCode, int resultCode, Intent data) { frag.onActivityResult(requestCode & 0xffff, resultCode, data); List<Fragment> frags = frag.getChildFragmentManager().getFragments(); if (frags != null) { for (Fragment f : frags) { if (f != null) handleResult(f, requestCode, resultCode, data); } } }
@Override public void release() { if (fragment != null) { FragmentManager fragmentManager = fragment.getFragmentManager(); if (fragmentManager != null) { FragmentTransaction transaction = null; Fragment tabFragment = fragmentManager.findFragmentById(android.R.id.tabcontent); if (tabFragment != null) { FragmentManager childManager = tabFragment.getChildFragmentManager(); transaction = childManager.beginTransaction(); } else { transaction = fragmentManager.beginTransaction(); } transaction.remove(fragment); transaction.commit(); } } super.release(); }
public static List<Fragment> fragmentChildFragmentManagerActive(Fragment fragment) { return ((FragmentManagerImpl) fragment.getChildFragmentManager()).mActive; }
public MoodManualPagerAdapter(Fragment f) { super(f.getChildFragmentManager()); mFrag = f; }
public FragmentStatePagerAdapterFix(Fragment fragment) { mFragmentManager = fragment.getChildFragmentManager(); wrFragmentActivity = new WeakReference<>(fragment.getActivity()); wrParentFragment = new WeakReference<>(fragment); }