Starting Application Again from MAIN & Clearing the activity stack
<p>I have developed an android 2.1 application which consumes Soap Web Service.
When my application gets started, it first checks whether there is internet connectivity or not.</p>

<p>If so, it will display corresponding activity.
If not then it will display an Activity(NetworkErrorActivity) giving information about network errors and all.</p>

<p>The problem is if there is no internet connectivity, it shows me the NetworkErrorActivity.
Now when user presses back button it redirects the user to Home.
I have overriden onBackPressed method like this :</p>

<p>@Override
        public void onBackPressed() {</p>

<pre><code>        Intent setIntent = new Intent(Intent.ACTION_MAIN);
        setIntent.addCategory(Intent.CATEGORY_HOME);
        setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(setIntent); 
        return;
    }
</code></pre>

<p>After pressing back button, it shows me the android home screen.
But the problem is when i start the same application again, it shows me the NetworkErrorActivity even if there is network connectivity. Could not start the application from Main Launcher Activity. It always shows me the same Activity again and again.</p>
