Example usage for android.text TextUtils writeToParcel

List of usage examples for android.text TextUtils writeToParcel

Introduction

In this page you can find the example usage for android.text TextUtils writeToParcel.

Prototype

public static void writeToParcel(CharSequence cs, Parcel p, int parcelableFlags) 

Source Link

Document

Flatten a CharSequence and whatever styles can be copied across processes into the parcel.

Usage

From source file:Main.java

public static byte[] toByteArray(Spanned spanned) {
    Parcel obtain = Parcel.obtain();//from   w  w  w .ja  v a 2s . co m
    TextUtils.writeToParcel(spanned, obtain, 0);
    byte[] byteArray = obtain.marshall();
    obtain.recycle();
    return byteArray;
}

From source file:de.mrapp.android.dialog.datastructure.ViewPagerItem.java

@Override
public final void writeToParcel(final Parcel dest, final int flags) {
    TextUtils.writeToParcel(getTitle(), dest, flags);
    dest.writeSerializable(getFragmentClass());
    dest.writeBundle(getArguments());/*from w w  w. j  a  v a2 s .c o m*/
}

From source file:com.achep.base.dashboard.DashboardCategory.java

/**
 * {@inheritDoc}//from w  w w  . j  av a  2 s. com
 */
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(titleRes);
    TextUtils.writeToParcel(title, dest, flags);

    final int count = tiles.size();
    dest.writeInt(count);

    for (int n = 0; n < count; n++) {
        DashboardTile tile = tiles.get(n);
        tile.writeToParcel(dest, flags);
    }
}

From source file:com.chuhan.privatecalc.fragment.os.BackStackState.java

public void writeToParcel(Parcel dest, int flags) {
    dest.writeIntArray(mOps);//  w w  w  . j  av  a2s  .  c om
    dest.writeInt(mTransition);
    dest.writeInt(mTransitionStyle);
    dest.writeString(mName);
    dest.writeInt(mIndex);
    dest.writeInt(mBreadCrumbTitleRes);
    TextUtils.writeToParcel(mBreadCrumbTitleText, dest, 0);
    dest.writeInt(mBreadCrumbShortTitleRes);
    TextUtils.writeToParcel(mBreadCrumbShortTitleText, dest, 0);
}

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

@Override
public final void writeToParcel(final Parcel dest, final int flags) {
    TextUtils.writeToParcel(getTitle(), dest, flags);
    TextUtils.writeToParcel(getSummary(), dest, flags);
    TextUtils.writeToParcel(getBreadCrumbTitle(), dest, flags);
    TextUtils.writeToParcel(getBreadCrumbShortTitle(), dest, flags);
    Bitmap bitmap = (getIcon() != null && getIcon() instanceof BitmapDrawable)
            ? ((BitmapDrawable) getIcon()).getBitmap()
            : null;// w  w w . j ava  2 s. c o m
    dest.writeParcelable(bitmap, flags);
    dest.writeString(getFragment());
    dest.writeBundle(getExtras());

    if (getIntent() != null) {
        dest.writeInt(1);
        getIntent().writeToParcel(dest, flags);
    } else {
        dest.writeInt(0);
    }
}

From source file:android.app.Notification.java

/**
 * Flatten this notification from a parcel.
 *//*from w w w. j  a v a  2s  .  co  m*/
public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeInt(1);

    parcel.writeLong(when);
    parcel.writeInt(icon);
    parcel.writeInt(number);
    if (contentIntent != null) {
        parcel.writeInt(1);
        contentIntent.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
    if (deleteIntent != null) {
        parcel.writeInt(1);
        deleteIntent.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
    if (tickerText != null) {
        parcel.writeInt(1);
        TextUtils.writeToParcel(tickerText, parcel, flags);
    } else {
        parcel.writeInt(0);
    }
    if (tickerView != null) {
        parcel.writeInt(1);
        tickerView.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
    if (contentView != null) {
        parcel.writeInt(1);
        contentView.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
    if (largeIcon != null) {
        parcel.writeInt(1);
        largeIcon.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }

    parcel.writeInt(defaults);
    parcel.writeInt(this.flags);

    if (sound != null) {
        parcel.writeInt(1);
        sound.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
    parcel.writeInt(audioStreamType);
    parcel.writeLongArray(vibrate);
    parcel.writeInt(ledARGB);
    parcel.writeInt(ledOnMS);
    parcel.writeInt(ledOffMS);
    parcel.writeInt(iconLevel);

    if (fullScreenIntent != null) {
        parcel.writeInt(1);
        fullScreenIntent.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }

    parcel.writeInt(priority);

    parcel.writeStringArray(kind); // ok for null

    if (extras != null) {
        parcel.writeInt(1);
        extras.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }

    parcel.writeTypedArray(actions, 0);

    if (bigContentView != null) {
        parcel.writeInt(1);
        bigContentView.writeToParcel(parcel, 0);
    } else {
        parcel.writeInt(0);
    }
}