How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity? Any help ? Thanks.
I dont think you can call finish() without storing a reference of the activity. You can manipulate the activity stack though using appropriate Intent flags(see ACTIVITY_CLEAR_TOP); see if that can help.
That would be rude. In fact, it's the kind of thing a virus would do. And on top of that, I believe the Dalvik memory model effectively partitions Activities as though each one ran in its own provate VM, so direct access into the internals of an Activity are made impossible.
The proper way if you want an activity to be cancellable is to provide a notification to that activity so it can decide whether it should shoutdown and how to clean up.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jul 13, 2009
Tim Holloway wrote:The proper way if you want an activity to be cancellable is to provide a notification to that activity so it can decide whether it should shoutdown and how to clean up.
I think but not sure ( as i am very new to Android) , this is the right way. So I am going with making an intent which carries a message for finishing the activity and registering the target activity with this additional intent which on listening this , kills itself. Any other suggestions welcome.
subject: Finish any previous activity in stack from current activity?