Remove multiple Activities to go Back to Dashboard from Options menu
<p>I have a Optionsmenu in my Android App, in which is a Button to Go Back to the Apps Dashboad and remove all Activities laying upon that, also removing the History. How is this possible?</p>

<p>thx</p>

<p>Got the Answer:</p>

<p>That's what does the Trick:</p>

<p>myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);</p>

<pre><code>public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.dashboard:
        Intent myIntent = new Intent(this, DashBoard.class);
        myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(myIntent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}
</code></pre>
