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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:16:13+00:00 2026-06-12T18:16:13+00:00

I am developing for android using android annotations. I have a singleton observable object

  • 0

I am developing for android using android annotations. I have a singleton observable object for which I want to add activity as an observer. Something like as follows:

@EActivity(R.layout.myActivity)
public class MyActivity extends SherlockActivity implements Observer { 

    @Bean //has singleton scope
    protected Observerable o;

    @Override
    public void onCreate() {
        o.registerObserver(this);
    }

    @Override
    public void onDestroy() {
        o.unregisterObserver(this);
    }

    //more code

My question lies with the on destroy method. Will there be a situation where android kills the activity during a stopped or paused state without calling onDestroy()? If this is the case my Observerable could be keeping a live reference to an activity that is no longer used by the system, which is not good. Or is this not the case? If it is my presumption would be to keep weak references to all my activities in my list of registered observers, so they can be unregistered automatically. Is this a good solution or is it not needed?

  • 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-12T18:16:15+00:00Added an answer on June 12, 2026 at 6:16 pm

    The OS can kill your process without calling onDestroy, but otherwise you can rely on onDestroy being called. So provided your Observable is in the same process as the activity, you’re fine.

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

Sidebar

Related Questions

I have experience developing in android and using REST services, but now I'd like
i am developing an android app using phonegap. I have trouble displaying special characters
I am currently developing an android application using eclipse and I already have a
I'm developing Android application using third party libraries (Twitter4j). I want to be able
I am developing fot Android using NetBeans. I have moved from Eclipse, where I
I am developing an android application using google maps. I have to display some
hi i am developing an android application using phonegap and i have come across
i have a scenario like this: I am developing an android peer to peer
i am developing android application using Geocoder services, I have an application where I
Is there any official guide for developing Android apps using HTML and CSS like

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.