1

A is my main screen B is an activity in my flow C is an activity that user is taken to once he clicks on a link in B

I need user to be going like A - >B ->C

Now when I click back button on C I should be taken to A. However, when I click back once I reach A, C pops up.

I know it still exists in memory and I have tried FLAG_ACTIVITY_CLEAR_TOP IT DOES NOT WORK FOR MY CASE.

I want all activities running in background to be destroyed once A's oncreate is called. How do I do that?

A has noHistory true B DOES NOT have noHistory true C has noHistory true

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Ackman
  • 1,562
  • 6
  • 31
  • 54

1 Answers1

1

Add android:launchMode="singleTop" in the Manifest of Activity A

From Activity C use:

Intent in = new Intent(mContext, A.class);
in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK );
startActivity(in);
finish();

You can find more information here

Community
  • 1
  • 1
Ognian Gloushkov
  • 2,669
  • 1
  • 20
  • 35