Pendingintent传值问题

更新时间:2023-08-12 03:01:41 阅读: 评论:0

摩登家庭第四季电视剧Pendingintent传值问题
Pendingintent传值问题tuneup
pendingintent传值经常获取到的值是第⼀次的值或者null,这个跟第⼆个参数和最后⼀个参数选择有关系。
PendingIntent pendingIntent = Activity(this, id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
注:如果所要启动的Activity是单例模式,其传值⽅法请看
flash音乐
总结⼀下pendingIntent的常⽤FLAG标签:
keepquietFLAG_ONE_SHOT:this PendingIntent can only be ud once. If t, after nd() is called on it, it will be automatically canceled for you and any future attempt to nd through it will fail.
mogong
FLAG_NO_CREATE:if the described PendingIntent does not already exist, then simply return null instead of creating it.
伴娘我最大FLAG_CANCEL_CURRENT:if the described PendingIntent already exists, the current one is canceled before generating a new one. You can u this to retrieve a new PendingIntent when you are only changing the extra data in the Intent; by canceling the previous pending intent, this ensures that only entities given the new data will be able to launch it. If this assurance is not an issue, consider FLAG_UPDATE_CURRENT.juggernaut
FLAG_UPDATE_CURRENT: if the described PendingIntent already exists, then keep it but its replace its extra data with what is in this new Intent. This can be ud if you are creating intents where only the extras change, and don't care that any entities that received your previous PendingIntent will be able to launch it with your new extras even if they are not explicitly given to it.
上⾯4个flag中最经常使⽤的是FLAG_UPDATE_CURRENT,因为描述的Intent有更新的时候需要⽤到这个flag去更新你的描述,否则组件在下次事件发⽣或时间到达的时候extras永远是第⼀次Intent的extras。使⽤FLAG_CANCEL_CURRENT也能做到更新extras,只不过是先把前⾯的extras清除,另外FLAG_CANCEL_CURRENT和FLAG_UPDATE_CURRENT 的区别在于能否新new⼀个Intent,FLAG_UPDATE_CURRENT能够新new⼀个Intent,⽽FLAG_CANCEL_CURRENT则不能,只能使⽤第⼀次的Intent。
suitup
paint是什么意思中文>陆谷孙
另外两flag就⽐较少⽤,利⽤FLAG_ONE_SHOT获取的PendingIntent只能使⽤⼀次,再使⽤PendingIntent也将失败,利⽤FLAG_NO_CREAT获取的PendingIntent若描述的Intent 不存在则返回NULL值.

本文发布于:2023-08-12 03:01:41,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/194246.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:传值   时候   时间   获取   单例
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图