Sunday, August 2, 2015

How to clear the activities history in Android

You can use this to clear the activities history in Android 
Add android:noHistory="true" attribute to your <activity> in the AndroidManifest.xml like this:
<activity android:name=".MyActivity"
    android:noHistory="true">
</activity>
Alternative way to clear the activities history in Android 
Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(
    Intent.FLAG_ACTIVITY_CLEAR_TOP | 
    Intent.FLAG_ACTIVITY_CLEAR_TASK | 
    Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);

No comments:

Post a Comment