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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:29:31+00:00 2026-06-16T11:29:31+00:00

In my app the activity which is currently running needs data from an activity

  • 0

In my app the activity which is currently running needs data from an activity which has started it. The parent activity has an object which method needs to be invoked to get the required data.

I am doing like this

In the ParentActivity

public static Puzzle  puzzle;  // Puzzle is a class

In the child activity

Puzzle puzzle = ParentActivity.puzzle;

ArrayList<String> cells = puzzle.getItemList();

It seems to work. But I am not sure about correctness of this approach. It allowed in android.
Will android run-time form destroying the parent activity.

  • 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-06-16T11:29:36+00:00Added an answer on June 16, 2026 at 11:29 am

    If Puzzle is some plain object representing a data model, what you have is “correct” so long as you consider this to only be a cache and if Puzzle and its contents are fairly small.

    Your process can be terminated at any time after it leaves the foreground. At that point, your cached Puzzle vanishes. Any data that needs to survive needs to be stored persistently: file, database, SharedPreferences, “the cloud”, whatever. Your static Puzzle can be a cache of that persistent data, but the real data model is the persistent store, not the cached Puzzle.

    Also, static data members represent intentional memory leaks. Anything referenced by that static Puzzle cannot be garbage collected. That works so long as the Puzzle is small. This is also why it is important for Puzzle to be an ordinary Object, not something more complex (e.g., an Activity) — the more complex the object, the more memory you leak.

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

Sidebar

Related Questions

Noob alert! I started my current app as a simple test activity running the
I'm currently in the process of developing an app which has some very demanding
My Android app has a ContactsList activity in which I simply display a list
I am running into a peculiar issue with an app which has multiple Activities.
My app starts up at Activity A which contains a ListView. The ListView can
I have an Android app which includes an activity called Help This uses a
I am making an app in which i have a main activity that the
I am newbie in android, in my android app, a main Activity class, which
Currently I have an app that is setup in two sections, the activity portion
I currently have an Android application that has an intent-filter to receive images from

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.