Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7740139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:41:59+00:00 2026-06-01T08:41:59+00:00

I want to be able to send formatted text (i.e., text with format spans)

  • 0

I want to be able to send formatted text (i.e., text with format spans) from one of my app activities to another. These CharSequence instances live deep inside some Parcelable types that I created.

For instance, when marshalling one of the types that carries formatted CharSequences I use TextUtils.writeToParcel as follows:

public class HoldsCharSequence {

    /* some formatted string that uses basic spans (e.g., ForegroundColorSpan) */
    private CharSequence cs;

    public void writeToParcel(Parcel out, int flags) {
        TextUtils.writeToParcel(cs, out, 0);
    }

    /* ... rest of the code ... */
}

The problem is that I don’t know how to retrieve the CharSequence from the Parcel in my private constructor.

The following does not work:

private HoldsCharSequence(Parcel in) {
    cs = (CharSequence) in.readValue(CharSequence.class.getClassLoader());
}

I get the following error:

android.os.BadParcelableException: ClassNotFoundException when unmarshalling

Two more things:
1. I have already succesfully implemented my own custom Parcelable objects, the problem is with CharSequences in particular.
2. I know that TextUtils.writeToParcel will do a best-effort job at saving the text format, I can live with that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:42:00+00:00Added an answer on June 1, 2026 at 8:42 am

    In case someone else is interested, I found the answer in this post.

    The correct way to retrieve CharSequences that were stored in a Parcel using TextUtils.writeToParcel(...) is

    cs = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to send files from an iPhone app to a
I have an app where we want users to be able to send us
I want to be able to send arbitrary messages from my iphone to the
For my new app Im working on I want to be able to send
I want to be able to send e-mail from my own domain (Domain.com) over
I want to be able to send a simple http post from my firefox
I want to be able to send video stream from my application to a
I want to be able to send a message from my mkmapview delegate class
I want to be able to send a simple post from an ASP code.
I want to be able to send the text on the clipboard, in Windows,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.