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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:16:39+00:00 2026-06-15T13:16:39+00:00

I have an application that keeps some complex data in memory between activities. As

  • 0

I have an application that keeps some complex data in memory between activities.

As for now I use a Singleton class that use SharedPreferences in getters and setters.

What I want: As long as my application is live and showing in the recent apps, I want a class to never get released or find a way to achieve this another way without consequences.

  • So I was wondering, is a better way available to me?
  • Would a Service be better?
  • If so, should I start and/or bind it?
  • 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-15T13:16:41+00:00Added an answer on June 15, 2026 at 1:16 pm

    If you go with a service, you wouldn’t bind it as unbinding could cause it to stop.

    You could create a static object and create it in a custom Application class. So for as long as your application is alive the object is held by a strong reference.

    Or a combination, use a singleton class but let the application class store the reference to prevent garbagecollection(GC)

    after chat:

    a service running in its own process should be the most persistent thing you could build. However you need to communicate with the service via AIDL, a cross-process bridge, which draws performance if the communication is high-speed.

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

Sidebar

Related Questions

I have written an application that keeps erasing my shared preference. It was always
I have an application that uses MKMapView and at some point in the app
I have an small ASP.NET application that reads data from a table and sends
I am trying to develop an application that keeps track of daily stock data.
I have an application that records audio and draws the waveform (along with some
I have a CoreData-based application that retrieves data about past events from an SQLite
I am creating a simple application that keeps track of coins. I have a
My application keeps forceclosing when I try to view the class that is holding
If have a union that currently foresees some simple data types: union Value {
I have some common functions that apply throughout my application to update particular parts

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.