Clear all current activities and start a new activity in background?
<p>I have an application where after a certain amount of time I want all activities in the app's stack to be removed and replaced by a login activity screen. I've got a Runnable timer that issues this set of statements:</p>

<pre><code>Intent intent = new Intent( ctx, mainActivity.class );
intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP );
ctx.startActivity( intent );
</code></pre>

<p>This works fine when my app is in the foreground, however, when my app is in the background and I'm using another app (say, the Web Browser), the timer fires as it should and pops up the login activity screen to the foreground.</p>

<p>What I want is for the login activity to be activated and moved to the front of the stack, and have all other activities in the stack removed, but not have the app and activity popped to the foreground over any currently running app. </p>

<p>Is there any way to do this with a different method or flag? Thanks. </p>
