lomza lomza - 1 year ago 115
Android Question


Can somebody explain me in a really simple way what does

mean? I know there were a lot of questions about it, but none of the answers satisfied me. Can somebody also give an example where this flag is useful? Thanks.

Answer Source

Please check the below link for the details of the same:


What it means is: let's say you have 4 activities, A, B, C, and D, and the flow is

A -> B -> C -> D

and now when you are on D you want to start activity B (from the stack and not a new instance) then you can use this intent flag. Also what it does is remove all the other activities on top of B (here C and D).

A realtime example would be an email app with activities ReadMailInInbox -> OpenMailFullScreen -> ReplyMail once you reply to your mail you wont want to go back to OpenMailFullScreen rather you would want your ReadMailInInbox activity to come on top so you can start this activity by passing an intent with the flag set as FLAG_ACTIVITY_CLEAR_TOP.

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download