How do you stop a certain Activity from being resumed when you relaunch an app from the homescreen?
<p>My Android app has a main activity, where a user clicks a button, which starts a "loading activity" with a spinner, which starts the results activity when finished loading. </p>

<p>The loading activity is simply an onCreate function that spawns a new thread that fetches information from the web.</p>

<p>Often times, after using my app for a while, the loading activity will be the one that is shown when resuming my app from the homescreen. The activity runs forever, spinner spinning the whole time. The only thing I can do is press the home key to close the app (and the problem remains until force closing the app). How do you prevent this? I want my main activity to start in these cases.</p>

<p>I've tried adding the following override function, but it didn't work:</p>

<pre><code>@Override
public void onResume() {
    super.onResume();
    finish();
}
</code></pre>
