Example usage for android.os Bundle putParcelable

List of usage examples for android.os Bundle putParcelable

Introduction

In this page you can find the example usage for android.os Bundle putParcelable.

Prototype

public void putParcelable(@Nullable String key, @Nullable Parcelable value) 

Source Link

Document

Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:codingpractice.renard314.com.products.ui.ProductDetailFragment.java

public static ProductDetailFragment newInstance(Product product) {
    final ProductDetailFragment productDetailFragment = new ProductDetailFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_PRODUCT, product);
    productDetailFragment.setArguments(args);
    return productDetailFragment;
}

From source file:com.cerema.cloud2.ui.preview.FileDownloadFragment.java

/**
 * Public factory method to create a new fragment that shows the progress of a file download.
 *
 * Android strongly recommends keep the empty constructor of fragments as the only public constructor, and
 * use {@link #setArguments(Bundle)} to set the needed arguments.
 *
 * This method hides to client objects the need of doing the construction in two steps.
 *
 * When 'file' is null creates a dummy layout (useful when a file wasn't tapped before).
 *
 * @param file                      An {@link OCFile} to show in the fragment
 * @param account                   An OC account; needed to start downloads
 * @param ignoreFirstSavedState     Flag to work around an unexpected behaviour of {@link FragmentStatePagerAdapter}
 *                                  TODO better solution
 *//*from w  w w.j  a  v  a 2s.c o m*/
public static Fragment newInstance(OCFile file, Account account, boolean ignoreFirstSavedState) {
    FileDownloadFragment frag = new FileDownloadFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_FILE, file);
    args.putParcelable(ARG_ACCOUNT, account);
    args.putBoolean(ARG_IGNORE_FIRST, ignoreFirstSavedState);
    frag.setArguments(args);
    return frag;
}

From source file:com.akop.bach.fragment.xboxlive.SentMessagesFragment.java

public static SentMessagesFragment newInstance(XboxLiveAccount account) {
    SentMessagesFragment f = new SentMessagesFragment();

    Bundle args = new Bundle();
    args.putParcelable("account", account);
    f.setArguments(args);/*from  w ww .  jav  a 2s  .  co m*/

    return f;
}

From source file:com.coderstory.FTool.utils.licensesdialog.LicensesDialogFragment.java

private static LicensesDialogFragment newInstance(final Notices notices, final boolean showFullLicenseText,
        final boolean includeOwnLicense, final int themeResourceId, final int dividerColor,
        final boolean useAppCompat) {
    final LicensesDialogFragment licensesDialogFragment = new LicensesDialogFragment();
    final Bundle args = new Bundle();
    args.putParcelable(ARGUMENT_NOTICES, notices);
    args.putBoolean(ARGUMENT_FULL_LICENSE_TEXT, showFullLicenseText);
    args.putBoolean(ARGUMENT_INCLUDE_OWN_LICENSE, includeOwnLicense);
    args.putInt(ARGUMENT_THEME_XML_ID, themeResourceId);
    args.putInt(ARGUMENT_DIVIDER_COLOR, dividerColor);
    args.putBoolean(ARGUMENT_USE_APPCOMPAT, useAppCompat);
    licensesDialogFragment.setArguments(args);
    return licensesDialogFragment;
}

From source file:ca.ualberta.cmput301.t03.inventory.UserInventoryFragment.java

public static UserInventoryFragment newInstance(User u) {
    UserInventoryFragment fragment = new UserInventoryFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_PARAM1, Parcels.wrap(u));

    fragment.setArguments(args);//  w  ww  .ja va  2  s  .c o  m
    return fragment;
}

From source file:com.codeslap.topy.BaseActivity.java

/**
 * Converts an intent into a {@link Bundle} suitable for use as fragment
 * arguments.//from   w  w  w. j av  a2s.c  o m
 */
public static Bundle intentToFragmentArguments(Intent intent) {
    Bundle arguments = new Bundle();
    if (intent == null) {
        return arguments;
    }

    final Uri data = intent.getData();
    if (data != null) {
        arguments.putParcelable(URI_KEY, data);
    }

    final Bundle extras = intent.getExtras();
    if (extras != null) {
        arguments.putAll(intent.getExtras());
    }

    return arguments;
}

From source file:com.ruesga.rview.fragments.SnippetFragment.java

public static SnippetFragment newInstance(Context context, Uri snippet, String mimeType) {
    SnippetFragment fragment = new SnippetFragment();
    Bundle arguments = new Bundle();
    if (snippet != null) {
        arguments.putParcelable(EXTRA_SNIPPET_URI, snippet);
        arguments.putString(EXTRA_SNIPPET_MIMETYPE, mimeType);
    } else {//from   w ww  . j a v  a2s .  c  o m
        try {
            Uri uri = CacheHelper.createNewTemporaryFileUri(context, ".snippet");
            arguments.putParcelable(EXTRA_TEMP_SNIPPET_URI, uri);
        } catch (IOException ex) {
            Log.e(TAG, "Can't create temporary snippet", ex);
        }
    }

    fragment.setArguments(arguments);
    return fragment;
}

From source file:de.aw.awlib.fragments.AWRemoteFileChooser.java

/**
 * Erstellt eine neue Instanz eines FileChooser, zeigt die Daten des uebergebenen
 * Verzeichnisnamen an//from  w ww.  j a  v  a  2  s .com
 *
 * @return Fragment
 *
 * @throws IllegalStateException
 *         wenn das Verzeichnis kein Directory ist
 */
public static AWRemoteFileChooser newInstance(AWRemoteFileServer fileServer) {
    Bundle args = new Bundle();
    AWRemoteFileChooser fragment = new AWRemoteFileChooser();
    args.putParcelable(REMOTEFILESERVER, fileServer);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.gmail.at.faint545.fragments.QueueFragment.java

public static QueueFragment newInstance(Remote mRemote) {
    QueueFragment self = new QueueFragment();
    Bundle args = new Bundle();
    args.putParcelable("remote", mRemote);
    self.setArguments(args);//from w w w .  j a v a 2  s .c  o  m
    return self;
}

From source file:com.collecdoo.fragment.main.RegisterDriverPhotoFragment.java

public static RegisterDriverPhotoFragment init(UserInfo userInfo, boolean wasPassenger,
        boolean isUpdateProfile) {
    RegisterDriverPhotoFragment registerDriverFragment = new RegisterDriverPhotoFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable("userInfo", userInfo);
    bundle.putBoolean("wasPassenger", wasPassenger);
    bundle.putBoolean("isUpdateProfile", isUpdateProfile);
    registerDriverFragment.setArguments(bundle);
    return registerDriverFragment;
}