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

The Archive Base Latest Questions

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

In the onCreate() method I load a list of levels. This is stored in

  • 0

In the onCreate() method I load a list of levels. This is stored in a singleton structure (using an enum for this). When I press the back button and return again, the list is still there and all the levels are added again. I don’t understand why this is happening, since the Activity Lifecycle states that the process is killed before onCreate() is called again.

Why is this happening?

edit, some code:

In separate file:

public enum GameInformation {
   INSTANCE;
       public List<Level> levelSet;

       public void loadLevelSet(Context context) {
       ...
       }
}

In main activity:

public void onCreate(Bundle savedInstanceState) {
    GameInformation.INSTANCE.loadLevelSet(this);
}
  • 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-24T02:09:58+00:00Added an answer on May 24, 2026 at 2:09 am

    I don’t understand why this is happening, since the Activity Lifecycle states that the process is killed before onCreate() is called again.

    No, it does not.

    The process is most certainly not killed immediately when your last activity is destroyed via the BACK button. Android will keep the process around, even if you have no active components, in case the user happens to want to return quickly to the app. Later on, when Android needs RAM, it will then terminate the process.

    You should not be making any assumptions whatsoever as to whether static data members will or will not be there. Just lazy-initialize them if they are null.

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

Sidebar

Related Questions

This is my activity oncreate() method. I set a positive button ok with a
I'm using the loadUrl() method in an activity's onCreate() method to load content from
I made an application and inside onCreate method i load 16 different soundpools. Everything
In my activity oncreate method, i have called a service using OnStartCommand(). My requirement
I added this part of the code in my onCreate() method and it crashes
I have noticed that when using actionBar.setSelectedNavigationItem(x) in the onCreate() method of my Activity,
I wrote this code in the onCreate() method, but nothing was played ! SoundPool
This is my onCreate method of my first activity of my app. It initalizes
I get a nullpointerexception when I do this: EditText[] answers; //At the oncreate method
I have an Activity that contains 12 ImageViews. In onCreate method I load 12

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.