Start new Activity and finish current one in Android?

pixel picture pixel · Jul 3, 2012 · Viewed 108.7k times · Source

Currently I'm starting a new Activity and calling finish on a current one.

Is there any flag that can be passed to Intent that enables finishing current Activity without a need to call finish manually from code?

Answer

Simon Dorociak picture Simon Dorociak · Jul 3, 2012

You can use finish() method or you can use:

android:noHistory="true"

And then there is no need to call finish() anymore.

<activity android:name=".ClassName" android:noHistory="true" ... />