---
title: "The last callback in the lifecycle of an activity is onDestroy()..."  
description: "The last callback in the lifecycle of an activity is onDestroy()..."  
author: "Hemant Patel"  
published: 2018-01-10  
updated: 2018-01-10  
canonical: https://answers.mindstick.com/qa/32778/the-last-callback-in-the-lifecycle-of-an-activity-is-ondestroy  
category: "technology"  
tags: ["android"]  
reading_time: 1 minute  

---

# The last callback in the lifecycle of an activity is onDestroy()...

The last [callback](https://www.mindstick.com/articles/152/using-the-callback) in the [lifecycle](https://yourviews.mindstick.com/view/10392/how-is-the-vendor-lifecycle-impacting-the-energy-sector-in-north-america) of an [activity](https://www.mindstick.com/blog/23160/fidgetsguide-exercise-guides-newsletters) is onDestroy(). The system calls this [method on your](https://www.mindstick.com/interview/12746/the-last-callback-in-the-lifecycle-of-an-activity-is-ondestroy-the-system-calls-this-method-on-your-activity-as-the-final-signal-that-your-activity-instance-is-being-completely-removed-from-the-sys) activity as the final [signal](https://www.mindstick.com/news/2024/elon-musk-and-twitter-are-now-fighting-about-signal-messages) that [your activity](https://www.mindstick.com/interview/2585/where-will-you-declare-your-activity-so-the-system-can-access-it) [instance](https://www.mindstick.com/forum/1739/object-reference-is-not-set-to-an-instance-of-an-object-error-in-my-code) is being completely removed from the [system memory](https://answers.mindstick.com/qa/114726/how-do-you-troubleshoot-frequent-application-errors-related-to-insufficient-system-memory). Usually, the system will call onPause() and onStop() before calling onDestroy(). [Describe](https://www.mindstick.com/forum/158512/how-does-a-decision-tree-algorithm-work-describe-the-process-of-building-a-decision-tree) a [scenario](https://www.mindstick.com/articles/126146/the-current-scenario-of-cryptocurrency-exchange-platforms), though, where onPause() and onStop() would not be invoked.

## Answers

### Answer by Prateek sharma

to understand this scenario let's look at the example -

```
@Override
public void onCreate(Bundle savedInstanceState){
//calling super class
 super.onCreate(savedInstanceState);
//some work here
//calling finish()
finish();
}
@Override
public void onResume(){
//you need to tell the super class about this invocation, so
super.onResume();
//do your work
}
@Override
public void onPause(){
//you need to tell the super class about this invocation, so
super. onPause();
//do your work
}
@Override
public void onStop(){
//you need to tell the super class about this invocation, so
super. onStop();
}
@Override
public void onDestroy(){
//you need to tell the super class about this invocation, so
super. onDestroy ();
}
```

when the user calls the finish() method this will directly trigger the onDestroy() method without going through onPause() and onStop().

\


---

Original Source: https://answers.mindstick.com/qa/32778/the-last-callback-in-the-lifecycle-of-an-activity-is-ondestroy

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
