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:com.android.tv.dvr.ui.DvrUiHelper.java

/**
 * Shows the schedule dialog.// w  ww.  j a v  a  2s .c o m
 */
public static void showScheduleDialog(Activity activity, Program program, boolean addCurrentProgramToSeries) {
    if (SoftPreconditions.checkNotNull(program) == null) {
        return;
    }
    Bundle args = new Bundle();
    args.putParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM, program);
    args.putBoolean(DvrScheduleFragment.KEY_ADD_CURRENT_PROGRAM_TO_SERIES, addCurrentProgramToSeries);
    showDialogFragment(activity, new DvrScheduleDialogFragment(), args, true, true);
}

From source file:com.android.tv.dvr.ui.DvrUiHelper.java

/**
 * Shows the cancel all dialog for series schedules list.
 *//*from  w w  w.j  a  v a  2s .c om*/
public static void showCancelAllSeriesRecordingDialog(DvrSchedulesActivity activity,
        SeriesRecording seriesRecording) {
    DvrStopSeriesRecordingDialogFragment dvrStopSeriesRecordingDialogFragment = new DvrStopSeriesRecordingDialogFragment();
    Bundle arguments = new Bundle();
    arguments.putParcelable(DvrStopSeriesRecordingFragment.KEY_SERIES_RECORDING, seriesRecording);
    dvrStopSeriesRecordingDialogFragment.setArguments(arguments);
    dvrStopSeriesRecordingDialogFragment.show(activity.getFragmentManager(),
            DvrStopSeriesRecordingDialogFragment.DIALOG_TAG);
}

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

public static AchievementsFragment newInstance(XboxLiveAccount account, long titleId, boolean showGameTotals) {
    AchievementsFragment f = new AchievementsFragment();

    Bundle args = new Bundle();
    args.putParcelable("account", account);
    args.putLong("titleId", titleId);
    args.putBoolean("showGameTotals", showGameTotals);
    f.setArguments(args);//from  ww  w .  j a va2  s  . c o  m

    return f;
}

From source file:android.com.example.contactslist.ui.ContactDetailFragment.java

/**
 * Factory method to generate a new instance of the fragment given a contact Uri. A factory
 * method is preferable to simply using the constructor as it handles creating the bundle and
 * setting the bundle as an argument./*  w w w  . j a  v  a 2 s  .c o  m*/
 *
 * @param contactUri The contact Uri to load
 * @return A new instance of {@link ContactDetailFragment}
 */
public static ContactDetailFragment newInstance(Uri contactUri) {
    // Create new instance of this fragment
    final ContactDetailFragment fragment = new ContactDetailFragment();

    // Create and populate the args bundle
    final Bundle args = new Bundle();
    args.putParcelable(EXTRA_CONTACT_URI, contactUri);

    // Assign the args bundle to the new fragment
    fragment.setArguments(args);

    // Return fragment
    return fragment;
}

From source file:com.btmura.android.reddit.app.NavigationFragment.java

public static NavigationFragment newInstance(String requestedSubreddit, ThingBundle requestedThingBundle) {
    Bundle args = new Bundle(2);
    args.putString(ARG_REQUESTED_SUBREDDIT, requestedSubreddit);
    args.putParcelable(ARG_REQUESTED_THING_BUNDLE, requestedThingBundle);

    NavigationFragment frag = new NavigationFragment();
    frag.setArguments(args);// w ww.j  av  a  2 s  .c  o m
    return frag;
}

From source file:ca.frozen.curlingtv.activities.VideoFragment.java

public static VideoFragment newInstance(Camera camera, boolean fullScreen) {
    VideoFragment fragment = new VideoFragment();

    Bundle args = new Bundle();
    args.putParcelable(CAMERA, camera);
    args.putBoolean(FULL_SCREEN, fullScreen);
    fragment.setArguments(args);/*from  w  ww .  j  ava 2 s . co  m*/

    return fragment;
}

From source file:com.cerema.cloud2.ui.fragment.ShareFileFragment.java

/**
 * Public factory method to create new ShareFileFragment instances.
 *
 * @param fileToShare An {@link OCFile} to show in the fragment
 * @param account     An ownCloud account
 * @return A new instance of fragment ShareFileFragment.
 *//*from w w  w.  j  a v  a  2 s .co m*/
public static ShareFileFragment newInstance(OCFile fileToShare, Account account) {
    ShareFileFragment fragment = new ShareFileFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_FILE, fileToShare);
    args.putParcelable(ARG_ACCOUNT, account);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.android.contacts.group.GroupMembersFragment.java

public static GroupMembersFragment newInstance(Uri groupUri) {
    final Bundle args = new Bundle();
    args.putParcelable(ARG_GROUP_URI, groupUri);

    final GroupMembersFragment fragment = new GroupMembersFragment();
    fragment.setArguments(args);/* w  w  w . j  a  v a 2  s .  com*/
    return fragment;
}

From source file:com.facebook.share.internal.ShareInternalUtility.java

/**
 * Creates a new Request configured to upload an image to create a staging resource. Staging
 * resources allow you to post binary data such as images, in preparation for a post of an Open
 * Graph object or action which references the image. The URI returned when uploading a staging
 * resource may be passed as the image property for an Open Graph object or action.
 *
 * @param accessToken the access token to use, or null
 * @param image       the image to upload
 * @param callback    a callback that will be called when the request is completed to handle
 *                    success or error conditions
 * @return a Request that is ready to execute
 *//*from w w  w.ja  va  2 s .  co m*/
public static GraphRequest newUploadStagingResourceWithImageRequest(AccessToken accessToken, Bitmap image,
        Callback callback) {
    Bundle parameters = new Bundle(1);
    parameters.putParcelable(STAGING_PARAM, image);

    return new GraphRequest(accessToken, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback);
}

From source file:com.facebook.share.internal.ShareInternalUtility.java

/**
 * Creates a new Request configured to upload an image to create a staging resource. Staging
 * resources allow you to post binary data such as images, in preparation for a post of an Open
 * Graph object or action which references the image. The URI returned when uploading a staging
 * resource may be passed as the image property for an Open Graph object or action.
 *
 * @param accessToken the access token to use, or null
 * @param file        the file containing the image to upload
 * @param callback    a callback that will be called when the request is completed to handle
 *                    success or error conditions
 * @return a Request that is ready to execute
 * @throws FileNotFoundException/* w w w  .j ava  2s .  co  m*/
 */
public static GraphRequest newUploadStagingResourceWithImageRequest(AccessToken accessToken, File file,
        Callback callback) throws FileNotFoundException {
    ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
    GraphRequest.ParcelableResourceWithMimeType<ParcelFileDescriptor> resourceWithMimeType = new GraphRequest.ParcelableResourceWithMimeType<>(
            descriptor, "image/png");
    Bundle parameters = new Bundle(1);
    parameters.putParcelable(STAGING_PARAM, resourceWithMimeType);

    return new GraphRequest(accessToken, MY_STAGING_RESOURCES, parameters, HttpMethod.POST, callback);
}