Java Code Examples for android.support.v4.app.Fragment#isDetached()

The following examples show how to use android.support.v4.app.Fragment#isDetached() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DappBrowserFragment.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private void detachFragment(String tag) {
    if (!isAdded()) return; //the dappBrowserFragment itself may not yet be attached.
    Fragment fragment = getChildFragmentManager().findFragmentByTag(tag);
    if (fragment != null && fragment.isVisible() && !fragment.isDetached()) {
        getChildFragmentManager().beginTransaction()
                .remove(fragment)
                .commit();
    }
}
 
Example 2
Source File: BaseChangeFragments.java    From AndJie with GNU General Public License v2.0 5 votes vote down vote up
protected void attachFragment(int layout, Fragment f, String tag) {
	if (f != null) {
		if (f.isDetached()) {
			ensureTransaction();
			mFragmentTransaction.attach(f);
		} else if (!f.isAdded()) {
			ensureTransaction();
			mFragmentTransaction.add(layout, f, tag);
		}
	}
}
 
Example 3
Source File: FragmentStack.java    From fragmentstack with Apache License 2.0 5 votes vote down vote up
private void attachFragment(Fragment fragment, String tag) {
  if (fragment != null) {
    if (fragment.isDetached()) {
      ensureTransaction();

      fragmentTransaction.attach(fragment);
    } else if (!fragment.isAdded()) {
      ensureTransaction();

      fragmentTransaction.add(containerId, fragment, tag);
    }
  }
}
 
Example 4
Source File: BaseChangeFragments.java    From AndJie with GNU General Public License v2.0 4 votes vote down vote up
protected void detachFragment(Fragment f) {
	if (f != null && !f.isDetached()) {
		ensureTransaction();
		mFragmentTransaction.detach(f);
	}
}
 
Example 5
Source File: FragmentStack.java    From fragmentstack with Apache License 2.0 4 votes vote down vote up
private void detachFragment(Fragment fragment) {
  if (fragment != null && !fragment.isDetached()) {
    ensureTransaction();
    fragmentTransaction.detach(fragment);
  }
}