How to back out of Application from any point.
<p>I have an application that accesses a server.  I have many activities that access the server for data.  At various points in the application, I do a simple check to verify two things, 1) There is internet connectivity and 2) The server is not in maintenance mode or down.. If it is, I display an Activity detailing why and when the server will be back up.  </p>

<p>When a user clicks back in this "Server is down" Activity, I need to exit the application.  I have tried the following code/intent to call the "Server Down" activity but it doesn't work.</p>

<pre><code>Intent i = new Intent(this, ServerMaintenanceActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
</code></pre>

<p>I have looked all over and this is a very common problem faced with people typically on login/logout screens.  None of the solutions I find works for me.  I know it's possible because I have apps that do just this for example Spotify.  </p>

<p>Any ideas?  Thanks. </p>
