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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:02:09+00:00 2026-05-24T23:02:09+00:00

I have a ListView that uses an ArrayAdapter. The items in the ArrayAdapter are

  • 0

I have a ListView that uses an ArrayAdapter. The items in the ArrayAdapter are a custom object I’ve created.

I’ve extended this custom object from Parcelable. When the user rotates the screen and the instanceState is saved, it writes the ArrayList to the outState. When the ListActivity is recreated, the instanceState is read back in to the ArrayList. In onResume(), I then assign the ArrayList to the ArrayAdapter’s items variable, and then call setAdapter on the ListView with the ArrayAdapter.

Unfortunately, nothing shows up in the ListView.

I’ve debugged through and everything seems to be working perfectly fine until setAdapter is called. The ArrayList is read back in from the instanceState, all the data is there and preserved perfectly.

Any ideas?

Update:

I’ve fixed the issue. I’ll try to write an explanation here until stackoverflow lets me create an answer.

In onCreate(), I instantiate a new instance of my ArrayList. I then give that ArrayList to a new instance of my ArrayAdapter and call setAdapter on the ListView with this ArrayAdapter. After onCreate(), onRestoreInstanceState() gets called. In onRestoreInstanceState(), I essentially set my ArrayList to a new ArrayList (the one read from the InstanceState). Even though I then point my ArrayAdapter’s item variable at this new ArrayList, the ArrayAdapter seems to still be pointing at the old empty one. Thus, nothing shows up in the list. I’ve altered onRestoreInstanceState to copy the ArrayList read from the InstanceState to the already-declared ArrayList from onCreate().

  • 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-24T23:02:11+00:00Added an answer on May 24, 2026 at 11:02 pm

    In onCreate(), I instantiate a new instance of my ArrayList. I then give that ArrayList to a new instance of my ArrayAdapter and call setAdapter on the ListView with this ArrayAdapter. After onCreate(), onRestoreInstanceState() gets called. In onRestoreInstanceState(), I essentially set my ArrayList to a new ArrayList (the one read from the InstanceState). Even though I then point my ArrayAdapter’s item variable at this new ArrayList, the ArrayAdapter seems to still be pointing at the old empty one. Thus, nothing shows up in the list. I’ve altered onRestoreInstanceState to copy the ArrayList read from the InstanceState to the already-declared ArrayList from onCreate().

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

Sidebar

Related Questions

I have a custom ListView that uses a custom ArrayAdapter (which basically just overrides
I have a custom control that is derived from ListView . This list view
I have a ListView that I am populating with items from an ObservableCollection .
I have a ListView on a page that uses a object data source. I
I have a ListView that uses a custom adapter. The custom adapter's getView uses
I have a problem with my Android listview. My list uses a custom arrayadapter,
I have a ListView that uses a custom layout that has 5 child View
A have a ListView that is rendered with multiple items. Now I want to
I have an Android ListView, backed by an ArrayAdapter. When the user clicks on
I have a ListView that uses Linkify to create a link to another activity

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.