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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:19:02+00:00 2026-05-16T05:19:02+00:00

I have a member variable in my Activity which is an ArrayList. The objects

  • 0

I have a member variable in my Activity which is an ArrayList. The objects populating this ArrayList are objects I have defined called RatingItem. RatingItem has several member vars like rating, comment, id, etc.

I would like to save this ArrayList in onSaveInstanceState so it can be repopulated from onRestoreInstanceState. What is the best way to do this? I’ve never saved the state of an object of this complexity.

Thank you for your help

  • 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-16T05:19:03+00:00Added an answer on May 16, 2026 at 5:19 am

    You should probably have your object implement Parcelable. Basically, you have to add methods to write and read the members of your object from a Parcel, and then add custom CREATOR inner class that has a couple of static factory methods. There’s a demo of it on the first linked page, but it’s not too hard.

    Then you can just save the whole list in one go with Bundle.putParcelableArrayList(). (You’ll have to cast the list when you get it back out with Bundle.getParcelableArrayList() but it will work fine.)

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

Sidebar

Related Questions

I have a class that has a vector member variable, which I fill up
Suppose I have a class Base which has a member variable A* my_hash. I
I have a member variable which is a list of reference types. In a
If I have a C++ class which contains a static member variable, does the
Let's say I have a container class called myList . This container class has
Scenario : I have a member variable, an array-list,(which is not static, private member)
Say I have a member variable vector<bool> rightWall; . rightWall has width*height indices. I
If I have a member variable such as this (declared in the body of
I have a member variable that in a class that I want to make
I have a member variable that tells units for a value I have measured

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.