Keep AsyncTask during rotation but not on Activity removal
<p>I have an Activity that runs a simple AsyncTask. To keep the AsyncTask running during screen rotations I am using onRetaingNonConfigurationInstance() to pass the AsyncTask to the new Activity as recommended in one of the answers from the thread <a href="http://stackoverflow.com/questions/2620917/how-to-handle-an-asynctask-during-screen-rotation">How to handle an AsyncTask during Screen Rotation?</a> Then I update a pointer to the Activity in the AsyncTask to make sure it can still update the progress dialog from on onProgressUpdate().</p>

<p>My problem is that using this method I cannot detect if the Activity is only rotated (In this case I want to continue to run the AsyncTask) or if the Activity is hidden by the Home button in which case I'd like to stop the AsyncTask. I can however detect the usage of the back button because in this case the isFinishing() of the Activity returns true;</p>

<p>Is there any mechanism I could use to differentiate rotation versus home button usage?</p>
