Start an Android Intent without pushing on the history stack

I was wondering how to create an Intent with the Android SDK which will not be pushed on top of the history stack. Which means, if another Intent will be started, the back button pressed event will not move back to the specific Intent. Actually this is done pretty easy with setting a FLAG_ACTIVITY_NO_HISTORY. An example the is given with the following code snipped.

public void doSomething()
{
	Intent intent = new Intent(this, SomeOtherClass.class);
 
	// do not keep this intent in history
	intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
 
	startActivity(intent);
}

2 thoughts on “Start an Android Intent without pushing on the history stack

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">