Example usage for android.support.v4.app FragmentManager beginTransaction

List of usage examples for android.support.v4.app FragmentManager beginTransaction

Introduction

In this page you can find the example usage for android.support.v4.app FragmentManager beginTransaction.

Prototype

public abstract FragmentTransaction beginTransaction();

Source Link

Document

Start a series of edit operations on the Fragments associated with this FragmentManager.

Usage

From source file:com.android.simpleimageloader.image.ImageCache.java

/**
 * Locate an existing instance of this Fragment or if not found, create and add it using FragmentManager.
 * /*from  w w w  . j a v  a  2  s . c  o  m*/
 * @param fm The FragmentManager manager to use.
 * @return The existing instance of the Fragment or the new instance if just created.
 */
private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
    // BEGIN_INCLUDE(find_create_retain_fragment)
    // Check to see if we have retained the worker fragment.
    RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);

    // If not retained (or first time running), we need to create and add it.
    if (mRetainFragment == null) {
        mRetainFragment = new RetainFragment();
        fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss();
    }

    return mRetainFragment;
    // END_INCLUDE(find_create_retain_fragment)
}

From source file:android.bitmap.util.ImageCache.java

/**
 * Locate an existing instance of this Fragment or if not found, create and
 * add it using FragmentManager.//from w ww  . java 2  s.  c  o  m
 *
 * @param fm The FragmentManager manager to use.
 * @return The existing instance of the Fragment or the new instance if just
 *         created.
 */
private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
    // Check to see if we have retained the worker fragment.
    RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);

    // If not retained (or first time running), we need to create and add it.
    if (mRetainFragment == null) {
        mRetainFragment = new RetainFragment();
        fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss();
    }

    return mRetainFragment;
}

From source file:com.common.app.image.ImageCache.java

/**
 * Locate an existing instance of this Fragment or if not found, create and
 * add it using FragmentManager./*from  w  ww . j av a 2  s  .com*/
 *
 * @param fm The FragmentManager manager to use.
 * @return The existing instance of the Fragment or the new instance if just
 *         created.
 */
private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {

    // Check to see if we have retained the worker fragment.
    RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);

    // If not retained (or first time running), we need to create and add it.
    if (mRetainFragment == null) {
        mRetainFragment = new RetainFragment();
        fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss();
    }

    return mRetainFragment;

}

From source file:com.akalizakeza.apps.ishusho.activity.CommentsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_comments);

    String postKey = getIntent().getStringExtra(POST_KEY_EXTRA);
    if (postKey == null) {
        finish();/*w  w w.ja  v a 2 s  .c om*/
    }

    FragmentManager fm = getSupportFragmentManager();
    fm.beginTransaction().add(R.id.comments_fragment, CommentsFragment.newInstance(postKey)).commit();
}

From source file:com.deange.textfaker.ui.dialog.PatchedDialogFragment.java

@Override
public void show(final FragmentManager manager, final String tag) {
    show(manager.beginTransaction(), tag, false);
}

From source file:com.andrew.apollo.cache.ImageCache.java

/**
 * Locate an existing instance of this {@link Fragment} or if not found,
 * create and add it using {@link FragmentManager}
 * /*  w w w .  j  a  v a2  s .c  om*/
 * @param fm The {@link FragmentManager} to use
 * @return The existing instance of the {@link Fragment} or the new instance
 *         if just created
 */
public static final RetainFragment findOrCreateRetainFragment(final FragmentManager fm) {
    // Check to see if we have retained the worker fragment
    RetainFragment retainFragment = (RetainFragment) fm.findFragmentByTag(TAG);

    // If not retained, we need to create and add it
    if (retainFragment == null) {
        retainFragment = new RetainFragment();
        fm.beginTransaction().add(retainFragment, TAG).commit();
    }
    return retainFragment;
}

From source file:com.blogspot.ksoichiro.android.sample.transition.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.add(R.id.parent, new Fragment1(), "tag");
    ft.commit();/*  ww w .  j  av  a 2  s.c om*/
}

From source file:cn.com.wo.bitmap.ImageCache.java

/**
 * Locate an existing instance of this Fragment or if not found, create and
 * add it using FragmentManager.//from w w w  . j  a v a  2 s . c  om
 *
 * @param fm The FragmentManager manager to use.
 * @return The existing instance of the Fragment or the new instance if just
 *         created.
 */
private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
    // Check to see if we have retained the worker fragment.
    RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(ImageFetcher.TAG);

    // If not retained (or first time running), we need to create and add it.
    if (mRetainFragment == null) {
        mRetainFragment = new RetainFragment();
        fm.beginTransaction().add(mRetainFragment, ImageFetcher.TAG).commitAllowingStateLoss();
    }

    return mRetainFragment;
}

From source file:com.bilibili.boxing_impl.view.TestBlankActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_boxing);
    BoxingMediaLoader.getInstance().init(new IBoxingMediaLoader() {

        @Override/*www .  j a  v  a 2  s  .c  om*/
        public void displayThumbnail(@NonNull ImageView img, @NonNull String absPath, int width, int height) {

        }

        @Override
        public void displayRaw(@NonNull ImageView img, @NonNull String absPath, IBoxingCallback callback) {

        }
    });
    BoxingViewFragment fragment = BoxingViewFragment.newInstance();
    fragment.setTitleTxt((TextView) findViewById(R.id.pick_album_txt));
    fragment.setPresenter(new PickerPresenter(fragment));
    fragment.setPickerConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));

    final FragmentManager manager = getSupportFragmentManager();
    manager.beginTransaction().add(R.id.content_layout, fragment).commit();
}

From source file:angel.zhuoxiu.picker.utils.ImageCache.java

/**
 * Locate an existing instance of this Fragment or if not found, create and
 * add it using FragmentManager.//from  www  .  j a v  a 2  s  . c om
 *
 * @param fm The FragmentManager manager to use.
 * @return The existing instance of the Fragment or the new instance if just
 *         created.
 */
private static RetainFragment findOrCreateRetainFragment(FragmentManager fm) {
    //BEGIN_INCLUDE(find_create_retain_fragment)
    // Check to see if we have retained the worker fragment.
    RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG);

    // If not retained (or first time running), we need to create and add it.
    if (mRetainFragment == null) {
        mRetainFragment = new RetainFragment();
        fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss();
    }

    return mRetainFragment;
    //END_INCLUDE(find_create_retain_fragment)
}