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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:27:46+00:00 2026-05-23T15:27:46+00:00

Let’s say Activity A is created and then A starts a Service S and

  • 0

Let’s say Activity A is created and then A starts a Service S and binds itself to S. S notifies A of updates which will cause the state of A to change. What happens to A and S after Android pauses or stops A?

For instance:

  • Does pausing A automatically unbind it from S (thus stopping S if A is the last thing bound to it?)
  • Do updates from S cause A to be resumed?
  • Do updates from S never get passed to A and no error occurs?
  • Can S become aware that A is paused or stopped? (for instance by a call to something like A.isAsleep())

Also, How do I handle the situation so that the “right thing” happens? Do I unbind services in onPause() and re-bind upon onResume()?

  • 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-23T15:27:47+00:00Added an answer on May 23, 2026 at 3:27 pm

    (A) will be unbound from (S) onPause, but if you didn’t call an unbind method, I think you will get a memory leak.

    Unless you rebind (A) to (S) onResume(), (A) will note be aware of (S) unless the activity is recreated.

    Depends on how you are sending updates. NPE’s can happen for sure if you at all reference (A) and it happens to be destroyed while paused.

    (S) will only be aware that (A) was paused if you have a method of communicating this to (S) as you have done.

    And yes, you have it just right. You should bind and unbind onResume and onPause.

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

Sidebar

Related Questions

Let's say I have a method in java, which looks up a user in
Let's say after I had login I will be prompt to enter the Name
Let's say I'm making a tool to help epicureans keep track of which delicacies
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I have a dataset, which can be neatly classified using weka's J48
Let's say I'm writing a Windows Forms (.NET Framework 3.5) application which shows the
Let's say I'm outputting a post title and in our database, it's Hello Y’all
Let's say I'm extending JFileChooser and making an easy-to-use version, which I'm calling SimpleFileChooser
Let's say I have a HomeController which has an Index action, in the Index.cshtml
Let's have an example like below: package xliiv.sandbox; import android.app.Activity; import android.os.Bundle; import android.util.Log;

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.