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.server.telecom.testapps.CallNotificationReceiver.java

public static void addNewUnknownCall(Context context, Uri handle, Bundle extras) {
    Log.i(TAG, "Adding new unknown call with handle " + handle);
    PhoneAccountHandle phoneAccount = new PhoneAccountHandle(
            new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID);

    if (extras == null) {
        extras = new Bundle();
    }//from  w  ww  .  ja v  a 2  s.  c om

    if (handle != null) {
        extras.putParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE, handle);
        extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle);
    }

    TelecomManager.from(context).addNewUnknownCall(phoneAccount, extras);
}

From source file:butter.droid.fragments.MediaListFragment.java

public static MediaListFragment newInstance(Mode mode, MediaProvider provider,
        MediaProvider.Filters.Sort filter, MediaProvider.Filters.Order defOrder, String genre) {
    MediaListFragment frag = new MediaListFragment();
    Bundle args = new Bundle();
    args.putParcelable(EXTRA_PROVIDER, provider);
    args.putSerializable(EXTRA_MODE, mode);
    args.putSerializable(EXTRA_SORT, filter);
    args.putSerializable(EXTRA_ORDER, defOrder);
    args.putString(EXTRA_GENRE, genre);//  w  ww.j a va2 s  .c om
    frag.setArguments(args);
    return frag;
}

From source file:com.ryan.ryanreader.fragments.PostListingFragment.java

public static PostListingFragment newInstance(final RedditSubreddit subreddit, final URI url,
        final UUID session, final CacheRequest.DownloadType downloadType) {

    final PostListingFragment f = new PostListingFragment();

    final Bundle bundle = new Bundle(4);

    bundle.putParcelable("subreddit", subreddit);
    bundle.putString("url", url.toString());
    if (session != null)
        bundle.putString("session", session.toString());
    bundle.putString("downloadType", downloadType.name());

    f.setArguments(bundle);/*from   w  w w .j a  v  a2 s . c o  m*/

    return f;
}

From source file:com.android.msahakyan.fma.fragment.TrackDetailFragment.java

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * @param tracks The list of tracks in the current {@link com.android.msahakyan.fma.model.Album}
 * @return A new instance of fragment AlbumDetailFragment.
 *///ww w.j  a  va 2 s.  c om
public static TrackDetailFragment newInstance(ArrayList<Item> tracks, int position) {
    TrackDetailFragment fragment = new TrackDetailFragment();
    Bundle args = new Bundle();
    args.putParcelable(KEY_ITEM_PARCEL, tracks.get(position));
    args.putParcelableArrayList(KEY_ITEM_LIST, tracks);
    args.putInt(KEY_ITEM_POSITION, position);
    fragment.setArguments(args);

    return fragment;
}

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

/**
 * Public factory method to create a new fragment that previews an image.
 *
 * Android strongly recommends keep the empty constructor of fragments as the only public
 * constructor, and/* w ww. j  a  va 2 s  .co m*/
 * use {@link #setArguments(Bundle)} to set the needed arguments.
 *
 * This method hides to client objects the need of doing the construction in two steps.
 *
 * @param imageFile                 An {@link OCFile} to preview as an image in the fragment
 * @param ignoreFirstSavedState     Flag to work around an unexpected behaviour of
 *                                  {@link FragmentStatePagerAdapter}
 *                                  ; TODO better solution
 */
public static PreviewImageFragment newInstance(OCFile imageFile, boolean ignoreFirstSavedState) {
    PreviewImageFragment frag = new PreviewImageFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_FILE, imageFile);
    args.putBoolean(ARG_IGNORE_FIRST, ignoreFirstSavedState);
    frag.setArguments(args);
    return frag;
}

From source file:com.appsimobile.appsii.module.apps.ReorderAppsFragment.java

public static Fragment createInstance(AppTag appTag) {
    ReorderAppsFragment result = new ReorderAppsFragment();
    Bundle args = new Bundle();
    args.putParcelable("tag", appTag);

    result.setArguments(args);/*from  ww w .j a  v a2s. c o m*/
    return result;
}

From source file:com.akop.bach.fragment.playstation.TrophiesFragment.java

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

    Bundle args = new Bundle();
    args.putParcelable("account", account);
    args.putLong("titleId", titleId);
    args.putBoolean("showGameTotals", showGameTotals);
    f.setArguments(args);/*from www .  ja v a 2 s  .c o m*/

    return f;
}

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

/**
 * Shows the dialog which says that the new schedule conflicts with others.
 *///from w  w w  .  j  a  v  a  2  s  .  c  om
public static void showScheduleConflictDialog(Activity activity, Program program) {
    if (program == null) {
        return;
    }
    Bundle args = new Bundle();
    args.putParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM, program);
    showDialogFragment(activity, new DvrProgramConflictDialogFragment(), args, false, true);
}

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

/**
 * Shows "already scheduled" dialog.//  ww  w. ja v  a 2s.c  o  m
 */
public static void showAlreadyScheduleDialog(Activity activity, Program program) {
    if (program == null) {
        return;
    }
    Bundle args = new Bundle();
    args.putParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM, program);
    showDialogFragment(activity, new DvrAlreadyScheduledDialogFragment(), args, false, true);
}

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

/**
 * Shows "already recorded" dialog.//w  ww.j  a  v a2s . c o m
 */
public static void showAlreadyRecordedDialog(Activity activity, Program program) {
    if (program == null) {
        return;
    }
    Bundle args = new Bundle();
    args.putParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM, program);
    showDialogFragment(activity, new DvrAlreadyRecordedDialogFragment(), args, false, true);
}