Misbehaviour of Backstack of activity when activity destroyed <p>I have two activities; let's say A and B. In <code>activity A</code> there is a broadcast receiver registered that listens for a particular event which will finish activity A. I am registering the broadcast receiver in <code>onCreate()</code>, and destroying it in <code>onDestroy()</code> of <code>activity A</code>.</p> <p>For simplicity, there is one <code>button</code> in <code>activity B</code> named "Destroy Activity A". When a user clicks on <code>button</code>, <code>activity A</code> should be destroyed.</p> <p>Normally all of this is running smoothly without any issues,but the problem occurs in following scenarios:</p> <p>1) Suppose I am in <code>activity B</code> and i press the Home key to move the application to the background then if i use other resource-heavy applications, Android system will kill my application to free memory. Then If I open my application from recent tasks, <code>activity B</code> will be resumed, and it's <code>onCreate()</code>, <code>onResume()</code> etc method will be called. Now I press <code>button</code> to destroy <code>activity A</code>, but activity A has already been destroyed, so <code>activity A</code>'s <code>onCreate()</code>, <code>onResume()</code> etc methods will not be called until and unless i go to <code>activity A</code> by pressing the <code>back button</code>. Thus <code>broadcast receiver</code> is not registered to listen for the event.</p> <p>2) The same problem will arise when user has selected "Don't keep activities" from Developer options in the device's settings.</p> <p>I have been looking to solve this issue for a long time, but i am unable to find a proper answer. What is the best way to handle this scenario? Is this an Android bug? There should be some solution for this issue.</p> <p>Please help me.</p>