How can an AsyncTask still use an Activity if the user has already navigated away from it?
<p>On Android you can do work in a separate <code>Thread</code> for example by using a <code>Runnable</code> or <code>AsyncTask</code>.  In both cases you might need to do some work after the work is done, for example by overriding <code>onPostExecute()</code> in the <code>AsyncTask</code>. However the user might navigate away or close the app while work is being done in the background. </p>

<p>My question is: What happens if the user navigates away or closes the app while I still have a reference to the <code>Activity</code> the user just closed in my <code>AsyncTask</code>? </p>

<p>My guess is that it should be destroyed as soon as the user navigates away,  however when I test it out on a device for some reason I can still call methods on the <code>Activity</code> even though it is already gone! What is going on here? </p>