Example usage for android.app FragmentTransaction disallowAddToBackStack

List of usage examples for android.app FragmentTransaction disallowAddToBackStack

Introduction

In this page you can find the example usage for android.app FragmentTransaction disallowAddToBackStack.

Prototype

public abstract FragmentTransaction disallowAddToBackStack();

Source Link

Document

Disallow calls to #addToBackStack(String) .

Usage

From source file:com.amazon.android.ui.widget.EllipsizedTextView.java

/**
 * Creates the read dialog fragment and adds it to the fragment.
 *//*w  w w. jav  a2s  . c o  m*/
private void showReadDialog() {
    // Show the dialog
    final ReadDialogFragment dialog = new ReadDialogFragment();
    if (mExpandedContentViewProvider == null) {
        dialog.setContentViewProvider(getDefaultExpandedContentProvider(this));
    } else {
        dialog.setContentViewProvider(mExpandedContentViewProvider);
    }

    if (mReadDialogHeight != 0 && mReadDialogWidth != 0) {
        final Bundle args = new Bundle();
        args.putInt(ReadDialogFragment.INTENT_EXTRA_DIALOG_WIDTH, mReadDialogWidth);
        args.putInt(ReadDialogFragment.INTENT_EXTRA_DIALOG_HEIGHT, mReadDialogHeight);

        dialog.setArguments(args);
    }

    // Commit allowing state loss, in case our activity is being destroyed we won't be in an
    // illegal state.
    final FragmentTransaction ft = ((Activity) getContext()).getFragmentManager().beginTransaction();
    ft.disallowAddToBackStack();
    ft.add(dialog, "read text");
    ft.commitAllowingStateLoss();
}

From source file:com.android.tv.settings.accessories.AddAccessoryActivity.java

protected void switchToMultipleDevicesFragment() {
    FragmentTransaction ft = mFragmentManager.beginTransaction();
    mContentFragment = AddAccessoryContentFragment.newInstance(true);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.replace(R.id.content_fragment, mContentFragment);
    ft.disallowAddToBackStack();

    ft.commit();//w  ww  . ja  v a 2  s.co  m
    mMsgHandler.sendEmptyMessageDelayed(MSG_MULTIPAIR_BLINK, BLINK_START);
    mShowingMultiFragment = true;
}