I think you are doing it wrong. You should probably leave your LoginActivity in stack instead of finishing it once user is logged in.
The code above will clear all activities above the launching one. For example: A -> B -> C -> D then we do this: startActivity(new Intent(getApplicationContext(), B.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); result will be; A -> B On Aug 16, 5:54 pm, Riv <[email protected]> wrote: > Will that work if I have a sequence of like > HomeActivity->Activity1->Activity2->LoginActivity. > > The logging out takes place at Activity2 which launches the > LoginActivity. > > On Aug 16, 2:38 am, Carl Lee <[email protected]> wrote: > > > > > > > > > Try this: > > startActivity(new Intent(getApplicationContext(), > > Login.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); > > > On Aug 16, 5:32 pm, Riv <[email protected]> wrote: > > > > How to finish all activities above the current activity in the task.? > > > I have an application that has logout option. When i logout and login > > > again, the last activity that was running before logging out is shown. > > > I want to finish all activities above the Login activity after logging > > > out. -- 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

