Android Intent not kept in the history stack

0 意見

If we start an intent but do not push on the history stack, this is pretty easy, we can use the setFlags function and set to FLAG_ACTIVITY_NO_HISTORY.

    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    intent.setClass(this, cpr.class);
    startActivity(intent);
In the current activity, but we don't need to kept in the history stack. we should change the Manifest.xml

<activity android:name='current' android:noHistory='true'>
</activity>

Intent | Android Developers