android 关闭活动,同时关闭几个android活动

If set, and the activity being

launched is already running in the

current task, then instead of

launching a new instance of that

activity, all of the other activities

on top of it will be closed and this

Intent will be delivered to the (now

on top) old activity as a new Intent.

For example, consider a task

consisting of the activities: A, B, C,

D. If D calls startActivity() with an

Intent that resolves to the component

of activity B, then C and D will be

finished and B receive the given

Intent, resulting in the stack now

being: A, B.

The currently running instance of

activity B in the above example will

either receive the new intent you are

starting here in its onNewIntent()

method, or be itself finished and

restarted with the new intent. If it

has declared its launch mode to be

“multiple” (the default) and you have

not set FLAG_ACTIVITY_SINGLE_TOP in

the same intent, then it will be

finished and re-created; for all other

launch modes or if

FLAG_ACTIVITY_SINGLE_TOP is set then

this Intent will be delivered to the

current instance’s onNewIntent().

This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK: if used to start the root activity of a task, it will bring any currently running instance of that task to the foreground, and then clear it to its root state. This is especially useful, for example, when launching an activity from the notification manager.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值