What just came in my mind, if it would suite your requirements: Start activities with startActivityForResult. When an activity started, register for broadcast and send the broadcast from your timer service. The last started activity recieves broadcast and calls its finish with result code, which you passes back to previous activity in stack. Once activity receives the code it also calls its finish passing result code to its previous etc. The last activity (A) starts your (E).
It might be better to put the logic in one place, either in activity class, the other will inherit, or in deligate class, if you use different kind of activities (list, map etc) and cannot inherit single one. Oh, yeah, and dont forget to unregister broadcast once an activity is paused. I guess, you cannot use this approach, if top activity in the stack is pause, therefore, you might try to use preferences to put a flag "close" there. When activity is resumed it can check the flag and call its finish with result code to inform parent activities to close. It would be interested if anyone knows other way. Regards, nakvic On Oct 9, 11:11 am, Jiang <[email protected]> wrote: > When some activities is created, such as A->B->C->D, and in a timer, I need > to close all activities in Ativity stack in the order D->C->B->A (the timer > don't know what activities have been created), and then start a new Activity > E. > > How to implement this feature? > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

