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 3661706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:20:06+00:00 2026-05-19T01:20:06+00:00

I asked a question the other day regarding sending an object to an activity

  • 0

I asked a question the other day regarding sending an object to an activity using an intent as a parcel but I am unsure how to do it in my situation. I have a variable of type object Object x; which is set with something like this: x = edit.getText().toString(); and in this instance x becomes a String object but I also have it able to set x as both an Integer and an SQLDate type. Looking at examples of how to send an object as a parcel it seems to me you have to know what the datatype is before hand even for custom datatypes. Any help with this will be greatly appreciated as i’m completely stuck on this.

Flow is:

Object x; – is created.

x = String object||Integer object||sqldate object – x is assigned a value

i.putExtra("object", x); – x is sent through to the next activity after being parcelled.

  • 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-19T01:20:07+00:00Added an answer on May 19, 2026 at 1:20 am

    The requirement on the data you pass inn is that it is serializable in some way, and yes, both String and Integer are. Also, if you’re using java.sql.Date, this type inherits util.Date which in turn inherits Serializable. The slight “problem” is that Intent.putExtra does not have an overload that takes Object as parameter type. Thus, you would have to “know” which data type you want to put:

    if (goingToUseStringObject...)
    {
        // use the CharSequence overload
        i.putExtra("object", stringObject);
    }
    else if (goingToUseIntegerObject...)
    {
        // use the int overload
        i.putExtra("object", integerObject);
    }
    else if (goingToUseDateObject...)
    {
        // use the Serializable overload
        i.putExtra("object", dateObject);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked a question the other day regarding overlay icons. With help, I figured
This is very similar to a question I asked the other day but my
This is very similar to a question I asked the other day but my
I asked a similar question the other day but it seems no one was
Someone asked me a question via e-mail about integer partitions the other day (as
This is related to a question I asked the other day on how to
It's a tricky question I was asked the other day... We're working on a
I talked to my instructor the other day and asked him this question. He
This question is related to one I asked the other day which I got
I asked a question the other day about how rows are added to a

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.