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.settings.profiles.SetupTriggersFragment.java

public static SetupTriggersFragment newInstance(Profile profile, boolean newProfile) {
    SetupTriggersFragment fragment = new SetupTriggersFragment();
    Bundle args = new Bundle();
    args.putParcelable(ProfilesSettings.EXTRA_PROFILE, profile);
    args.putBoolean(ProfilesSettings.EXTRA_NEW_PROFILE, newProfile);

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

From source file:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieDetailsFavFragment.java

/**
 * Returns a new instance of a {@link MovieDetailsFavFragment}.
 *
 * @param viewModel the view model to use for the view
 * @return a new instance of a {@link MovieDetailsFavFragment}
 *//*w  ww  . j av a 2  s  .c  o  m*/
public static MovieDetailsFavFragment newInstance(@NonNull MovieDetailsViewModel viewModel) {
    MovieDetailsFavFragment fragment = new MovieDetailsFavFragment();
    Bundle args = new Bundle();
    args.putParcelable(KEY_VIEW_MODEL, viewModel);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.actinarium.nagbox.ui.EditTaskDialogFragment.java

/**
 * Create a new instance of the dialog fragment, either to create or edit a task
 *
 * @param taskToEdit task to edit, or <code>null</code> to make a dialog for creating a new task
 * @return dialog fragment instance// w ww  .j a  v a  2  s .  c  om
 */
public static EditTaskDialogFragment newInstance(@Nullable Task taskToEdit) {
    EditTaskDialogFragment fragment = new EditTaskDialogFragment();
    Bundle args = new Bundle(1);
    args.putParcelable(ARG_TASK, taskToEdit);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.cesarvaliente.permissionssample.presentation.view.contact.ContactFragment.java

public static ContactFragment newInstance(ContactModel contact) {
    Bundle bundle = new Bundle();
    bundle.putParcelable(MainActivity.CURRENT_CONTACT_KEY, contact);

    ContactFragment fragment = new ContactFragment();
    fragment.setArguments(bundle);//from w w w .  j ava  2s .c o  m
    return fragment;
}

From source file:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieGridFavFragment.java

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

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

    fragment.setArguments(args);/*from  www  .j  a  v  a 2s. co m*/
    return fragment;
}

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

public static GameCatalogFilterFragment newInstance(PsnAccount account) {
    GameCatalogFilterFragment f = new GameCatalogFilterFragment();

    Bundle args = new Bundle();
    args.putParcelable("account", account);
    args.putInt("sortOrder", account.getCatalogSortOrder());
    args.putInt("releaseStatus", account.getCatalogReleaseStatus());
    args.putInt("console", account.getCatalogConsole());
    f.setArguments(args);//w  w  w.j av a 2s. co m

    return f;
}

From source file:Main.java

/**
 * Inverse operation of {@link #fragmentArgumentsToIntent(Bundle)}.
 *///from  w ww.  ja v a 2s .  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(extras);
    }
    return arguments;
}

From source file:Main.java

/**
 * Converts an intent into a {@link Bundle} suitable for use as fragment
 * arguments./* ww w .  ja  v  a2 s.  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", data);
    }

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

    return arguments;
}

From source file:com.adkdevelopment.rssreader.ui.DetailFragment.java

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * @return A new instance of fragment DetailFragment.
 *//*from  w w  w  .  j a va  2  s .  c om*/
public static DetailFragment newInstance(NewsObject item) {
    DetailFragment fragment = new DetailFragment();
    Bundle args = new Bundle();
    args.putParcelable(NewsObject.NEWS_EXTRA, item);
    fragment.setArguments(args);
    return fragment;
}

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

/**
 * Public factory method to create new SearchShareesFragment instances.
 *
 * @param fileToShare   An {@link OCFile} to be shared
 * @param account       The ownCloud account containing fileToShare
 * @return A new instance of fragment SearchShareesFragment.
 *//*from  w  w w  .j  ava 2  s .  c  om*/
public static SearchShareesFragment newInstance(OCFile fileToShare, Account account) {
    SearchShareesFragment fragment = new SearchShareesFragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_FILE, fileToShare);
    args.putParcelable(ARG_ACCOUNT, account);
    fragment.setArguments(args);
    return fragment;
}