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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:46:24+00:00 2026-05-23T17:46:24+00:00

I have an ArrayList of objects. ie ArrayList<ObjectName> . I want to pass this

  • 0

I have an ArrayList of objects. ie ArrayList<ObjectName>.

I want to pass this to a new Activity. I tried to use putParcelableArrayList but it has issues with the object. I removed the <ObjectName> part from the creating of the variable and the method works but then I get eclipse complaining about unsafe stuff.

How do I pass this ArrayList<ObjectName> to a new Activity

Thanks for your time

EDIT
I tried this :

ArrayList<ObjectName> arraylist = new Arraylist<ObjectName>();
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("arraylist", arraylist);

I get the following Error:

The method `putParcelableArrayList(String, ArrayList<? extends Parcelable>)` in the type `Bundle` is not applicable for the arguments `(String, ArrayList<ObjectName>)`

EDIT2
Object Example Code. Do I need to changed this for Parcelable to work?

public class ObjectName {
    private int value1;
    private int value2;
    private int value3;

    public ObjectName (int pValue1, int pValue2, int Value3) {
        value1 = pValue1;
        value2 = pValue2;
        value3 = pValue3;
    }

    // Get Statements for each value below
    public int getValue1() {
        return value1;
    } 
    // etc
  • 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-23T17:46:24+00:00Added an answer on May 23, 2026 at 5:46 pm

    Your object class should implement parcelable. The code below should get you started.

        public class ObjectName implements Parcelable {
    
        // Your existing code
    
            public ObjectName(Parcel in) {
                super(); 
                readFromParcel(in);
            }
    
            public static final Parcelable.Creator<ObjectName> CREATOR = new Parcelable.Creator<ObjectName>() {
                public ObjectName createFromParcel(Parcel in) {
                    return new ObjectName(in);
                }
    
                public ObjectName[] newArray(int size) {
    
                    return new ObjectName[size];
                }
    
            };
    
            public void readFromParcel(Parcel in) {
              Value1 = in.readInt();
              Value2 = in.readInt();
              Value3 = in.readInt();
    
            }
            public int describeContents() {
                return 0;
            }
    
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(Value1);
                dest.writeInt(Value2);  
                dest.writeInt(Value3);
           }
        }
    

    To use the above do this:

    In ‘sending’ activity use:

    ArrayList<ObjectName> arraylist = new Arraylist<ObjectName>();  
    Bundle bundle = new Bundle();  
    bundle.putParcelableArrayList("arraylist", arraylist);
    

    In ‘receiving’ activity use:

    Bundle extras = getIntent().getExtras();  
    ArrayList<ObjectName> arraylist  = extras.getParcelableArrayList("arraylist");  
    ObjectName object1 = arrayList[0];
    

    and so on.

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

Sidebar

Related Questions

I have an ArrayList that I want to use to hold RaceCar objects that
I have an array list of objects in my application. private static ArrayList<Player> userList=new
I have an ArrayList containing Objects that have a date value. Now I want
I have a member variable in my Activity which is an ArrayList. The objects
so suppose i have ArrayList<E> X = new ArrayList<E>(); and I pass X into
Hi I have an arrayList which has some objects.also my objects has two fields
I have an ArrayList , which I want to divide into smaller List objects
I have an ArrayList of custom objects. I want to remove duplicate entries. The
I have an ArrayList containing Car objects and I want to get from that
Say I have an ArrayList of USBDevice Objects. Each USBDevice has ProductID and VendorID

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.