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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:34:20+00:00 2026-05-26T08:34:20+00:00

My android game holds level layout data in an array list. While testing my

  • 0

My android game holds level layout data in an array list. While testing my level loader I noticed that sometimes my levels were failing to load leaving me with just a black screen. At first I thought it might be my textures not re-loading but I proved this wrong by drawing an object separate from the ArrayList and it drew just fine. Next I used a Log tag to check the size of my ArrayList. As soon as I pressed home and then re-opened my application the Log tag started returning a size of zero meaning all my data had been lost. Now I don’t really want to load my level data from file every time onPause is called so is there a way to preserve the data held in the ArrayList?

  • 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-26T08:34:20+00:00Added an answer on May 26, 2026 at 8:34 am

    The problem is you’re probably getting garbage collected (i.e. you’re pause is becoming a destroy because of memory issues). Implement the onSaveIntstanceState and onRestoreInstanceState methods in your Activity to see if that solves the problem.

    Num1 made a good point in the comment that I feel is worth point out. Note that bundles should contain small amounts of data. If your ArrayList is large, that’s probably why your activity is getting garbage collected in the same place. If that’s the case, you’ve got one of two options. Explicitly store the data on disk your self in the onDestroy method (that way you only do it when you really need to, writing to disk can take a while), or recalculating the stuff when your activity comes back into focus. This is just something good to think about.

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

Sidebar

Related Questions

Ive been working on multiplayer android game that sends locally stored data to a
I'm developing an Android game that has to download some assets to the SD
I am a beginner in Android game development, while searching i found Rokon, a
I am writing an android game. I need a Point class that stores x
I'm currently developing an Android game which saves data into a SQLite database. This
I'm developing a crime themed android game that will have a high maturity rating
I'm currently programming very simple game for Android (API level 7) to discover and
I am developing an android game application played using bluetooth. While searching for bluetooth
I'm writing a game in Android/OpenGLES, and when I use traceview, I see that
I am programming an android game that has a screen, which has a ScrollView

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.