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

  • Home
  • SEARCH
  • 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 1094021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:54:50+00:00 2026-05-16T23:54:50+00:00

I am trying to make Task parcelable to put into an bundle to pass

  • 0

I am trying to make Task parcelable to put into an bundle to pass from my service to activity but I’m having a little bit of trouble working with the ArrayList of my custom type.

Task:

@Override
public int describeContents() {
    // TODO Auto-generated method stub
    return 0;
}

@Override
public void writeToParcel(Parcel prc, int arg1) {
    // TODO Auto-generated method stub
    prc.writeInt(id);
    prc.writeString(timeStamp_string);
    prc.writeString(timeToComplete_string);
    prc.writeTypedArray(resources.toArray(), PARCELABLE_WRITE_RETURN_VALUE);
}

Resource:

@Override
public int describeContents() {
    // TODO Auto-generated method stub
    return 0;
}

@Override
public void writeToParcel(Parcel prc, int flags) {
    // TODO Auto-generated method stub
    prc.writeInt(id);
    prc.writeString(timeStamp_string);
    prc.writeString(resourceType);
    prc.writeString(dataType);
    prc.writeString(value);
    prc.writeInt(taskId);
}

It gives me an error on the prc.writeTypedArray function inside task:

Bound mismatch: The generic method writeTypedArray(T[], int) of type Parcel is not applicable for the arguments (Object[], int). The inferred type Object is not a valid substitute for the bounded parameter <T extends Parcelable>

If Resources is implementing Parcelable then I don’t see where the problem is.

Edit: I BELIEVE I FIXED THIS PART. I USED .writeParcelableList() INSTEAD. CAN SOMEONE CONFIRM THAT THIS SHOULD WORK? QUESTION BELOW IS STILL VALID.

Also when Task is read from the intent by the activity, I need to do some computation to fill some other data members. What function is called there that I can impliment to do the computation? Is it readFromParcel(…) or the constructor that takes in a Parcelable as a parameter?

Thanks

  • 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-05-16T23:54:50+00:00Added an answer on May 16, 2026 at 11:54 pm

    toArray() returns a type of Object[], which is why you’re getting:

    Object is not a valid substitute for the bounded parameter

    Object does not extend Parcelable. You must cast the toArray() call:

    (Resources[])resources.toArray()
    

    As you said, since Resources implements Parcelable, this should get rid of your exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.