Android - Executing extra unwanted tasks going back and forth
<p>i am experiencing some issue with my application that I cant figure out how to solve. When I start my application, my dashboard activity is launched and some network task is perfomed (download information in background). Then, I hit the news button and I am taken to the news activity, where I again download information in background to populate my list view with the latest news. To launch the activity news I use the following code:</p>

<pre><code>public void onNewsClick(View v) {
    startActivity(new Intent(this, NewsActivity.class));
}
</code></pre>

<p>Inside the news activity I have an action bar with a home button, where the user should press to get back to the dashboard. If I hit the android back button, the dashboad opens ok and the data the was downloaded the first time the dashboard was launched is not downloaded again (expected scenario). However, if I hit the home button, the dashboard opens and the data is downloaded again. The home button dispach the following code when pressed:</p>

<pre><code>public static Intent createIntent(Context context) {
    Intent i = new Intent(context, DashboardActivity.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    return i;
}
</code></pre>

<p>I would expect the dashboard to not download the data again if the home button is pressed. Furthermore, If I start the news activity again, the list of latest news will be downloaded again, which is causing a lot of traffic and i dont want it.</p>

<p>So I have two questions:
1. How can I take the user back to the dashboard whithout loading the data again?
2. How can I go back a secont time to my news activity whithout loading the list again?</p>

<p>Many thanks for any answer!
T </p>
