Example usage for android.content Intent CREATOR

List of usage examples for android.content Intent CREATOR

Introduction

In this page you can find the example usage for android.content Intent CREATOR.

Prototype

Parcelable.Creator CREATOR

To view the source code for android.content Intent CREATOR.

Click Source Link

Usage

From source file:Main.java

public static Intent intentFromByteArray(byte[] byteArray) {
    Parcel obtain = Parcel.obtain();/*from ww w. ja  v  a2  s. c  o m*/
    obtain.unmarshall(byteArray, 0, byteArray.length);
    obtain.setDataPosition(0);
    Intent createFromParcel = Intent.CREATOR.createFromParcel(obtain);
    obtain.recycle();
    return createFromParcel;
}

From source file:de.mrapp.android.preference.activity.PreferenceHeader.java

/**
 * Creates a new navigation item, which categorizes multiple preferences.
 *
 * @param source//from   www.  j  a  va2s . c o  m
 *         The parcel, the navigation item should be created from, as an instance of the class
 *         {@link Parcel}. The parcel may not be null
 */
@SuppressWarnings("deprecation")
private PreferenceHeader(@NonNull final Parcel source) {
    setTitle(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source));
    setSummary(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source));
    setBreadCrumbTitle(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source));
    setBreadCrumbShortTitle(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source));
    setIcon(new BitmapDrawable((Bitmap) source.readParcelable(Bitmap.class.getClassLoader())));
    setFragment(source.readString());
    setExtras(source.readBundle(getClass().getClassLoader()));

    if (source.readInt() != 0) {
        setIntent(Intent.CREATOR.createFromParcel(source));
    }
}