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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:02:40+00:00 2026-05-23T06:02:40+00:00

I have an app that potentially tracks a large amount of data during app

  • 0

I have an app that potentially tracks a large amount of data during app use for a single player, and my app can allow up to 5 players at a time, which means this large amount of data is potentially multiplied times 5.

I write all of the data to my SQLite database when the Activity is destroyed, and this works fine.

The problem occurs during an orientation change. I used onRetainNonConfigurationInstance because I thought that I could at least rely on it for orientation changes, but what I have found is that other things going on within Android can wipe out my data. Some examples reported by users:

- While the app was running, the user took a phone call. After returning to the app, the data was gone.
- While the app was running, another user downloaded an update to a different app from the Market, and found the data gone after returning to the app.
- While the app was running, another user started a different app (a music player), and returned to find the data gone.

I know that the use of onRetainNonConfigurationInstance is the problem because my app initially wrote each individual data field for each player to a bundle, and while the app was implemented that way, no problems were encountered over the course of many months.

As soon as I found out about onRetainNonConfigurationInstance and used that for my implementation, I started receiving complaints.

My implementation is simple. I implement as follows:

@Override
public Object onRetainNonConfigurationInstance()
{
    return mPlayers;  //array of player objects
}

Then in onCreate, I do this:

mPlayers = (PlayerData [])getLastNonConfigurationInstance();

Since there appears to be some underlying problem, what is the best alternative for retaining large amounts of user data across screen rotations?

Thanks for any assistance!

  • 1 1 Answer
  • 4 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-23T06:02:41+00:00Added an answer on May 23, 2026 at 6:02 am

    Use the Bundle: the problem with onRetainNonConfigurationInstance is that it is tied to the lifecycle of the app’s process, while the Bundle can be saved and restored even if the process is completely killed.

    If you are going to have folks going off and doing memory-intensive things that might result in the process getting killed then go with the Bundle.

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

Sidebar

Related Questions

I have an app that allows users to upload large data files and then
I have written an android app that saves (potentially) large files to the SD
I have an app that lets the user interact with several forms. I can
I have an app that received JSON data from the server. Currently when I
I have a little app that I want (potentially) a lot of my clients
I have a rails app that tracks membership cardholders, and needs to report on
I have an app that manages a list of third-party servers and can poll
I have a rails app that is tracking social data. The users are going
I've got an application that needs to have multiple app domains to isolate potentially
I have a project of business objects and a data layer that could potentially

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.