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:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieGridOnlFragment.java

public static MovieGridOnlFragment newInstance(@NonNull MovieGridViewModel viewModel) {
    MovieGridOnlFragment fragment = new MovieGridOnlFragment();

    Bundle args = new Bundle();
    args.putParcelable(KEY_VIEW_MODEL, viewModel);

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

From source file:com.arrata.user.cameratest.AspectRatioFragment.java

public static AspectRatioFragment newInstance(Set<AspectRatio> ratios, AspectRatio currentRatio) {
    final AspectRatioFragment fragment = new AspectRatioFragment();
    final Bundle args = new Bundle();
    args.putParcelableArray(ARG_ASPECT_RATIOS, ratios.toArray(new AspectRatio[ratios.size()]));
    args.putParcelable(ARG_CURRENT_ASPECT_RATIO, currentRatio);
    fragment.setArguments(args);/*from  w  ww . j  a va 2 s  .co m*/
    return fragment;
}

From source file:at.bitfire.davdroid.ui.CreateCollectionFragment.java

public static CreateCollectionFragment newInstance(Account account, CollectionInfo info) {
    CreateCollectionFragment frag = new CreateCollectionFragment();
    Bundle args = new Bundle(2);
    args.putParcelable(ARG_ACCOUNT, account);
    args.putSerializable(ARG_COLLECTION_INFO, info);
    frag.setArguments(args);/*from w ww . java2s . c  om*/
    return frag;
}

From source file:ca.ualberta.cmput301.t03.user.ViewProfileFragment.java

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * ex./*from  w  w w.  ja v  a2 s. c o m*/
 *  User u = new User("john12345", getContext());
 *  ViewProfileFragment v = ViewProfileFragment.newInstance(u);
 *  getSupportFragmentManager()
 *         .beginTransaction()
 *         .add(R.id.my_content_view, v)
 *         .commit()
 *
 * @param user The User whose profile should be viewed.
 * @return A new instance of fragment ViewProfileFragment.
 */
public static ViewProfileFragment newInstance(User user) {
    ViewProfileFragment fragment = new ViewProfileFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_PARAM1, Parcels.wrap(user));

    fragment.setArguments(args);
    return fragment;
}

From source file:app.com.timbuktu.fragment.ColorFragment.java

public static ColorFragment newInstance(int position, Collection collection, int backgroundColor) {
    ColorFragment fragment = new ColorFragment();
    Bundle bdl = new Bundle();
    bdl.putInt(EXTRA_COLOR, backgroundColor);
    bdl.putInt(EXTRA_POS, position);/*from ww w . ja  va  2  s .  c  o m*/
    bdl.putParcelable(EXTRA_COLLECTION, collection);

    /*if (collection != null && collection.getBitmap() != null) {
    Bitmap b = collection.getBitmap();
    ByteArrayOutputStream bs = new ByteArrayOutputStream();
    b.compress(Bitmap.CompressFormat.PNG, 50, bs);
    bdl.putByteArray("byteArray", bs.toByteArray());
    bdl.putBoolean("isBmpSet", false);
            
    } else {
    bdl.putBoolean("isBmpSet", false);
    }*/

    fragment.setArguments(bdl);
    return fragment;
}

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

public static HistoryFragment newInstance(Remote mRemote) {
    HistoryFragment self = new HistoryFragment();
    Bundle args = new Bundle();
    args.putParcelable("remote", mRemote);
    self.setArguments(args);// w w w.j a va  2 s.  co m
    return self;
}

From source file:palamarchuk.smartlife.app.fragments.ProfileFragment.java

public static ProfileFragment newInstance(UserInfo userInfo) {
    ProfileFragment profileFragment = new ProfileFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable(UserInfo.PARCELABLE_KEY, userInfo);
    profileFragment.setArguments(bundle);
    return profileFragment;
}

From source file:com.battlelancer.seriesguide.ui.dialogs.AddShowDialogFragment.java

public static AddShowDialogFragment newInstance(SearchResult show) {
    AddShowDialogFragment f = new AddShowDialogFragment();
    Bundle args = new Bundle();
    args.putParcelable(InitBundle.SEARCH_RESULT, show);
    f.setArguments(args);/*from  ww  w.j  a v  a  2  s.  c  om*/
    return f;
}

From source file:com.android.server.telecom.testapps.CallNotificationReceiver.java

/**
 * Creates and sends the intent to add an incoming call through Telecom.
 *
 * @param context The current context./*from  w  w  w . j  av a 2  s.com*/
 * @param isVideoCall {@code True} if this is a video call.
 */
public static void sendIncomingCallIntent(Context context, Uri handle, boolean isVideoCall) {
    PhoneAccountHandle phoneAccount = new PhoneAccountHandle(
            new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID);

    // For the purposes of testing, indicate whether the incoming call is a video call by
    // stashing an indicator in the EXTRA_INCOMING_CALL_EXTRAS.
    Bundle extras = new Bundle();
    extras.putBoolean(TestConnectionService.EXTRA_IS_VIDEO_CALL, isVideoCall);
    if (handle != null) {
        extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle);
    }

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

From source file:ch.gianulli.flashcards.ListsFragment.java

public static ListsFragment newInstance(Board board) {
    ListsFragment result = new ListsFragment();
    Bundle args = new Bundle();
    args.putParcelable(KEY_BOARD, board);
    result.setArguments(args);/*from  w  w w . j  av a 2  s  .  com*/
    return result;
}