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

  • Home
  • SEARCH
  • 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 5940467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:58:19+00:00 2026-05-22T15:58:19+00:00

According to the android Activity Lifecycle, the only callback guaranteed to be called (if

  • 0

According to the android Activity Lifecycle, the only callback guaranteed to be called (if an activity ever leaves the Running state, which is typically expected) is onPause().

So, I must assume that there are scenarios in which it makes sense to implement onStop() and onDestroy() although they are not really guaranteed to be called.

I understand that onStop() should be implemented when it’s possible for an activity to return to the Running state via the Stopped state (why would it do that instead of returning directly is a different question).

But the need for onDestroy(), when I can place all cleanup/state-saving into onPause(), is unclear to me.

Can you describe a real-app situation (i.e. not analogy to driving a car etc.) in which it would make sense to implement onDestroy()?

  • 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-22T15:58:20+00:00Added an answer on May 22, 2026 at 3:58 pm

    onDestroy will be called if you explicitly call finish(); yourself.

    Your main activity calls startActivityForResult on a map activity.

    Map activity with a LocationListener, the user clicks the map and selects say a local restaurant.

    The activity then , sets up some extras to be sent back to your main activity, it then explicitly call’s finish(); on itself and in the onDestroy kills the LocationListener and other variables you had invoked.

    Just found this in the docs

    onDestroy() = The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.

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

Sidebar

Related Questions

I'm using eclipse, and I have two android projects which have different topics. And
I have an Android application with a main activity that is the tabhost. I'm
I am creating an android application which has to execute web requests in the
Can anyone tell me how to make a flexible AppWidgets in Android according to
Are there different steps to register an Android Activity as a BROWSABLE intent on
I just set up eclipse to start android development according to this http://developer.android.com/sdk/installing.html .
According to the Android Developers' Guide , it is possible to create a custom
I'm using Android 2.3, so according to this post: Streaming Audio from A URL
Is there any methods to automatically switch the android GPS_PROVIDER and NETWORK_PROVIDER, according to
According to this discussion , the iphone agreement says that it doesn't allow loading

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.