Android应用开发—PendingIntent:如何判断两个PendingIntent对等
生活随笔
收集整理的這篇文章主要介紹了
Android应用开发—PendingIntent:如何判断两个PendingIntent对等
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
摘錄自:PendingIntent詳解
如何判斷兩個(gè)PendingIntent對等:
兩個(gè)PendingIntent對等是指它們的operation一樣, 且其它們的Intent的action, data, categories, components和flags都一樣。但是它們的Intent的Extra可以不一樣。
主要常量
- FLAG_CANCEL_CURRENT:如果當(dāng)前系統(tǒng)中已經(jīng)存在一個(gè)相同的PendingIntent對象,那么就將先將已有的PendingIntent取消,然后重新生成一個(gè)PendingIntent對象。
- FLAG_NO_CREATE:如果當(dāng)前系統(tǒng)中不存在相同的PendingIntent對象,系統(tǒng)將不會創(chuàng)建該P(yáng)endingIntent對象而是直接返回null。
- FLAG_ONE_SHOT:該P(yáng)endingIntent只作用一次。在該P(yáng)endingIntent對象通過send()方法觸發(fā)過后,PendingIntent將自動調(diào)用cancel()進(jìn)行銷毀,那么如果你再調(diào)用send()方法的話,系統(tǒng)將會返回一個(gè)SendIntentException。
- FLAG_UPDATE_CURRENT:如果系統(tǒng)中有一個(gè)和你描述的PendingIntent對等的PendingInent,那么系統(tǒng)將使用該P(yáng)endingIntent對象,但是會使用新的Intent來更新之前PendingIntent中的Intent對象數(shù)據(jù),例如更新Intent中的Extras。
總結(jié)
以上是生活随笔為你收集整理的Android应用开发—PendingIntent:如何判断两个PendingIntent对等的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python中文编码问题详解
- 下一篇: pyhon量化数据处理小细节3---日期