Return to the previous screen
Let's say I have an activity a, b, c, d. I can open d from any of Activity
. Now when I want the user to hit the back button, they should go back to the previous screen, but D should be on the stack, so I can't make a call finish()
. I tried with
with a clear top flag or
Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
when i click on the D button showing the notification , when he clicks the notification (even the app is in the background or foreground) it should kill DActivity
+3
source to share
1 answer
Use a flag FLAG_ACTIVITY_REORDER_TO_FRONT
in intent.
Intent intent = new Intent(context /*e.g. ActivityD*/, ActivityB.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
+1
source to share