Intent flags

int FLAG_ACTIVITY_BROUGHT_TO_FRONT This flag is not normally set by application code, but set for you by the system as described in the launchMode documentation for the singleTask mode. 这个标志一般不是由程序代码设置的,如在launchMode中设置singleTask模式时系统帮你设定。
int FLAG_ACTIVITY_CLEAR_TASK If set in an Intent passed to Context.startActivity(), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started. 
int FLAG_ACTIVITY_CLEAR_TOP 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. 如果设置,并且这个Activity已经在当前的Task中运行,因此,不再是重新启动一个这个Activity的实例,而是在这个Activity上方的所有Activity都将关闭,然后这个Intent会作为一个新的Intent投递到老的Activity(现在位于顶端)中。      例如,假设一个Task中包含这些Activity:A,B,C,D。如果D调用了startActivity(),并且包含一个指向Activity B的Intent,那么,C和D都将结束,然后B接收到这个Intent,因此,目前stack的状况是:A,B。      上例中正在运行的Activity B既可以在onNewIntent()中接收到这个新的Intent,也可以把自己关闭然后重新启动来接收这个Intent。如果它的启动模式声明为“multiple”(默认值),并且你没有在这个Intent中设置FLAG_ACTIVITY_SINGLE_TOP标志,那么它将关闭然后重新创建;对于其它的启动模式,或者在这个Intent中设置FLAG_ACTIVITY_SINGLE_TOP标志,都将把这个Intent投递到当前这个实例的onNewIntent()中。      这个启动模式还可以与FLAG_ACTIVITY_NEW_TASK结合起来使用:用于启动一个Task中的根Activity,它会把那个Task中任何运行的实例带入前台,然后清除它直到根Activity。这非常有用,例如,当从Notification Manager处启动一个Activity
int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET If set, this marks a point in the task's activity stack that should be cleared when the task is reset. 如果设置,这将在Task的Activity stack中设置一个还原点,当Task恢复时,需要清理Activity。也就是说,下一次Task带着FLAG_ACTIVITY_RESET_TASK_IF_NEEDED标记进入前台时(典型的操作是用户在主画面重启它),这个Activity和它之上的都将关闭,以至于用户不能再返回到它们,但是可以回到之前的Activity。      这在你的程序有分割点的时候很有用。例如,一个e-mail应用程序可能有一个操作是查看一个附件,需要启动图片浏览Activity来显示。这个Activity应该作为e-mail应用程序Task的一部分,因为这是用户在这个Task中触发的操作。然而,当用户离开这个Task,然后从主画面选择e-mail app,我们可能希望回到查看的会话中,但不是查看图片附件,因为这让人困惑。通过在启动图片浏览时设定这个标志,浏览及其它启动的Activity在下次用户返回到mail程序时都将全部清除。
int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS If set, the new activity is not kept in the list of recently launched activities.
int FLAG_ACTIVITY_FORWARD_RESULT If set and this intent is being used to launch a new activity from an existing one, then the reply target of the existing activity will be transfered to the new activity. 如果设置,并且这个Intent用于从一个存在的Activity启动一个新的Activity,那么,这个作为答复目标的Activity将会传到这个新的Activity中。这种方式下,新的Activity可以调用setResult(int),并且这个结果值将发送给那个作为答复目标的Activity。(和startActivityForResult有关系)
int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY This flag is not normally set by application code, but set for you by the system if this activity is being launched from history (longpress home key).
int FLAG_ACTIVITY_MULTIPLE_TASK Do not use this flag unless you are implementing your own top-level application launcher.
int FLAG_ACTIVITY_NEW_TASK If set, this activity will become the start of a new task on this history stack.
int FLAG_ACTIVITY_NO_ANIMATION If set in an Intent passed to Context.startActivity(), this flag will prevent the system from applying an activity transition animation to go to the next activity state.
int FLAG_ACTIVITY_NO_HISTORY If set, the new activity is not kept in the history stack.
int FLAG_ACTIVITY_NO_USER_ACTION If set, this flag will prevent the normal onUserLeaveHint() callback from occurring on the current frontmost activity before it is paused as the newly-started activity is brought to the front.
int FLAG_ACTIVITY_PREVIOUS_IS_TOP If set and this intent is being used to launch a new activity from an existing one, the current activity will not be counted as the top activity for deciding whether the new intent should be delivered to the top instead of starting a new one.
int FLAG_ACTIVITY_REORDER_TO_FRONT If set in an Intent passed to Context.startActivity(), this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.
int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED If set, and this activity is either being started in a new task or bringing to the top an existing task, then it will be launched as the front door of the task.
int FLAG_ACTIVITY_SINGLE_TOP If set, the activity will not be launched if it is already running at the top of the history stack.
int FLAG_ACTIVITY_TASK_ON_HOME If set in an Intent passed to Context.startActivity(), this flag will cause a newly launching task to be placed on top of the current home activity task (if there is one).
int FLAG_DEBUG_LOG_RESOLUTION A flag you can enable for debugging: when set, log messages will be printed during the resolution of this intent to show you what has been found to create the final resolved list.
int FLAG_EXCLUDE_STOPPED_PACKAGES If set, this intent will not match any components in packages that are currently stopped.
int FLAG_FROM_BACKGROUND Can be set by the caller to indicate that this Intent is coming from a background operation, not from direct user interaction.
int FLAG_GRANT_READ_URI_PERMISSION If set, the recipient of this Intent will be granted permission to perform read operations on the Uri in the Intent's data and any URIs specified in its ClipData.
int FLAG_GRANT_WRITE_URI_PERMISSION If set, the recipient of this Intent will be granted permission to perform write operations on the Uri in the Intent's data and any URIs specified in its ClipData.
int FLAG_INCLUDE_STOPPED_PACKAGES If set, this intent will always match any components in packages that are currently stopped.
int FLAG_RECEIVER_FOREGROUND If set, when sending a broadcast the recipient is allowed to run at foreground priority, with a shorter timeout interval.
int FLAG_RECEIVER_REGISTERED_ONLY If set, when sending a broadcast only registered receivers will be called -- no BroadcastReceiver components will be launched.
int FLAG_RECEIVER_REPLACE_PENDING If set, when sending a broadcast the new broadcast will replace any existing pending broadcast that matches it.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值