Quantcast
Channel: Removing an activity from the history stack - Stack Overflow
Viewing all articles
Browse latest Browse all 18

Answer by Aparna Juhi for Removing an activity from the history stack

$
0
0

Here I have listed few ways to accomplish this task:

  1. Go to the manifest.xml- and put android:noHistory="true", to remove the activity from the stack.

  2. While switching from present activity to some other activity, in intent set flag as (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK). It is demonstrated in the example below.

    Intent intent = new Intent(CurrentActivity.this, HomeActivity.class);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_CLEAR_TASK)startActivity(intent);here

Note :Putting the intent flags can cause blank screen for sometime (while switching activity).


Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>