Here's scenario. Say I have an app that I was using and navigated from activity to activity so now there's some history there. Then I switched to another app so my first one is on the background. If I return to it I would be able to click "Back" to navigate the history and traverse 1st app steps. Now imagine that I also have a notification that when clicked will bring one of the activities of the first app. Currently when that happens and I hit "Back" I will return to the previous history stack. My requirement - if I call activity using notification then I should have no history, If I hit back, the app should simply exit. Is is doable and how? This is related to my other former question which in the retrospect didn't really got the answer
Asked
Active
Viewed 542 times
1 Answers
1
Try looking up the various launch modes such as FLAG_ACTIVITY_CLEAR_TOP

Falmarri
- 47,727
- 41
- 151
- 191
-
This is actually right answer, I don't know who took a point form it but they are smoking bad weed. The trick is to add flag not to `PendingIntent` but to the `Intent` it will trigger. Something like this: `final Intent i = new Intent(context, OnAlarmReceiver.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); final PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);` – Bostone Nov 11 '10 at 02:28