public Intent setFlags (int flags) 解释

Intent android.content.Intent.setFlags(int flags)

 

public Intent setFlags (int flags)

Since: API Level 1

Set special flags controlling how this intent is handled. Most values here depend on the type of component being executed by the Intent, specifically the FLAG_ACTIVITY_* flags are all for use with Context.startActivity() and the FLAG_RECEIVER_* flags are all for use with Context.sendBroadcast().

为了控制整个Intent的执行设置特定的标志。大多数的值依赖于通过Intent执行的所有类型组件,例如明确的有Context.startActivity()的FLAG_ACTIVITY_*标志和Context.sendBroadcast()的FLAG_RECEIVER_*标志。

See the Tasks and Back Stack documentation for important information on how some of these options impact the behavior of your application.

 

Parameters

flags  The desired flags.

 

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

See Also

getFlags()

addFlags(int)

FLAG_GRANT_READ_URI_PERMISSION

FLAG_GRANT_WRITE_URI_PERMISSION

FLAG_DEBUG_LOG_RESOLUTION

FLAG_FROM_BACKGROUND

FLAG_ACTIVITY_BROUGHT_TO_FRONT

FLAG_ACTIVITY_CLEAR_TASK

FLAG_ACTIVITY_CLEAR_TOP

FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

FLAG_ACTIVITY_FORWARD_RESULT

FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY

FLAG_ACTIVITY_MULTIPLE_TASK

FLAG_ACTIVITY_NEW_TASK

FLAG_ACTIVITY_NO_ANIMATION

FLAG_ACTIVITY_NO_HISTORY

FLAG_ACTIVITY_NO_USER_ACTION

FLAG_ACTIVITY_PREVIOUS_IS_TOP

FLAG_ACTIVITY_RESET_TASK_IF_NEEDED

FLAG_ACTIVITY_REORDER_TO_FRONT

FLAG_ACTIVITY_SINGLE_TOP

FLAG_ACTIVITY_TASK_ON_HOME

FLAG_RECEIVER_REGISTERED_ONLY

例如:

// Pressing on the button brings the user back to our mood ring,

// as part of the api demos app.  Note the use of NEW_TASK here,

// since the notification display activity is run as a separate task.

Intent intent = new Intent(this, StatusBarNotifications.class);

intent.setAction(Intent.ACTION_MAIN);

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(intent);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值