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:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.video.SignSearchVideoActivity.java

@NonNull
private SignVideoFragment setupSignVideoFragment() {
    final Parcelable parcelledSign = getParcelable();
    final SignVideoFragment signVideoFragment = new SignVideoFragment();
    final Bundle args = new Bundle();
    args.putParcelable(SignVideoFragment.SIGN_TO_SHOW, parcelledSign);
    signVideoFragment.setArguments(args);
    return signVideoFragment;
}

From source file:com.bmd.android.collection.example.EnhancedArrayMapTest.java

public void testParcelable() {

    final Bundle bundle = new Bundle();
    bundle.putParcelable("array", mArray);

    final Parcel parcel = Parcel.obtain();
    bundle.writeToParcel(parcel, 0);//  w  w w  . ja  v  a 2  s .  c om

    parcel.setDataPosition(0);

    final Bundle out = parcel.readBundle();
    out.setClassLoader(AndroidCollections.class.getClassLoader());

    assertThat(out.getParcelable("array")).isEqualTo(mArray);
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.FavouriteThreadsFragment.java

/**
 * Set up the listView, adapter and listen for list item clicks.
 *//*from w  w  w  .  j  a va 2s .com*/
@Override
public void onStart() {
    super.onStart();
    favouritesListView = (ListView) getView().findViewById(R.id.favourites_list);
    ThreadListAdapter adapter = new ThreadListAdapter(getActivity(), list);
    // Assign custom adapter to the thread listView.
    favouritesListView.setAdapter(adapter);
    favouritesListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        /*
         * On click, launch the fragment responsible for thread viewing
         */
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Fragment fragment = new ThreadViewFragment();
            Bundle bundle = new Bundle();
            bundle.putParcelable("thread", list.get((int) id));
            fragment.setArguments(bundle);
            getFragmentManager().beginTransaction().replace(R.id.container, fragment, "thread_view_fragment")
                    .addToBackStack(null).commit();
            getFragmentManager().executePendingTransactions();
        }
    });
    adapter.notifyDataSetChanged();
}

From source file:com.moto.miletus.application.tabs.CommandsActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putParcelable(Strings.EXTRA_KEY_DEVICE, getDevice());
    outState.putParcelable(Strings.EXTRA_KEY_DEVICE_COMPONENT, getComponent());
    super.onSaveInstanceState(outState);
}

From source file:ca.shoaib.ping.PingDetailActivityFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable(KEY_DETAIL, mPingDetail);
}

From source file:com.burnevsky.firu.TranslationsActivity.java

TranslationsFragment createFragment(Word word) {
    TranslationsFragment f = new TranslationsFragment();

    Bundle args = new Bundle();
    args.putParcelable("word", word);
    f.setArguments(args);//  w  ww. java  2s .co  m

    return f;
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.FavouriteCommentsFragment.java

@Override
/**/* ww w. j a  v  a 2  s  . com*/
 * Displays a list view of favourites upon starting the fragment.
 * 
 */
public void onStart() {
    super.onStart();
    for (ThreadComment tc : list) {
        Log.e("FAVS", tc.getBodyComment().getId());
    }
    favouritesListView = (ListView) getView().findViewById(R.id.favourites_list);
    FavouriteCommentsAdapter adapter = new FavouriteCommentsAdapter(list, getActivity());
    // Assign custom adapter to the thread listView.
    favouritesListView.setAdapter(adapter);
    favouritesListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        /*
         * On click, launch the fragment responsible for thread viewing
         */
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Fragment fragment = new ThreadViewFragment();
            Bundle bundle = new Bundle();
            bundle.putParcelable("thread", list.get((int) position));
            bundle.putInt("favCom", -1);
            bundle.putLong("id", id);
            fragment.setArguments(bundle);
            getFragmentManager().beginTransaction().replace(R.id.container, fragment, "thread_view_fragment")
                    .addToBackStack(null).commit();
            // getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
            getFragmentManager().executePendingTransactions();
        }
    });
    adapter.notifyDataSetChanged();
}

From source file:android.support.content.TestQueryCallback.java

@Override
public @Nullable Cursor runQueryInBackground(Query query) {
    mQueryLatch.accept(query);//from ww w.  j  a v a 2  s. co m
    Bundle extras = new Bundle();
    extras.putParcelable(URI_KEY, query.getUri());
    extras.putInt(URI_PAGE_ID, query.getId());
    MatrixCursor cursor = new MatrixCursor(new String[] { "id" }, 0);
    cursor.setExtras(extras);
    return cursor;
}

From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticator.java

@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
        String[] requiredFeatures, Bundle options) throws NetworkErrorException {

    Log.d(TAG, "Add Account");
    final Intent intent = new Intent(mContext, GMSAuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}

From source file:co.edu.uniajc.vtf.content.controller.PoiDetailController.java

public void navigateToRouteMap() {
    Activity loActivity = ((Activity) this.coView);
    Intent loIntent = new Intent(loActivity, NavigationActivity.class);
    Bundle loBundle = new Bundle();
    loBundle.putParcelable("destiny", this.coView.getPoiData());
    loIntent.putExtras(loBundle);/*  w w  w . j a  va  2 s.  c o  m*/
    loActivity.startActivity(loIntent);
}