【问题标题】:What happens if you set the flag on a PendingIntent to 0?如果将 PendingIntent 上的标志设置为 0 会发生什么?
【发布时间】:2010-12-23 23:57:09
【问题描述】:

当您将待处理意图的标志设置为 0 时,究竟会发生什么?它只是不升旗还是默认为其他之一?

【问题讨论】:

    标签: android flags android-pendingintent


    【解决方案1】:

    不,这是创建新 PendingIntent 的“默认”行为,无论是否已经存在。如果您想要更专业的行为,例如在底层 Intent 相同的情况下取消现有的 PendingIntent,或者更新这样的现有 PendingIntent,那么您应该使用可以在 PendingIntent 类中找到的各种标志。

    【讨论】:

    • 其实这是错误的 :-( 默认行为(不设置标志,即:0 作为flags 参数)是返回一个现有的PendingIntent,如果有一个匹配提供的参数. 如果没有现有的匹配PendingIntent,则会创建并返回一个新的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-07
    • 2010-09-30
    • 1970-01-01
    • 2016-12-12
    • 2019-07-19
    相关资源
    最近更新 更多