您好,登录后才能下订单哦!
PendingIntent android.app.PendingIntent.getActivity(Context context,int requestCode,Intent intent,int flags)
源码注释:
Retrieve a PendingIntent that will start a new activity, like calling Context.startActivity(Intent)
. Note that the activity will be started outside of the context of an existing activity, so you must use theIntent.FLAG_ACTIVITY_NEW_TASK
launch flag in the Intent.
Parameters:
context The Context in which this PendingIntent should start the activity.
requestCode Private request code for the sender (currently not used).
intent Intent of the activity to be launched.
flags May be FLAG_ONE_SHOT
, FLAG_NO_CREATE
, FLAG_CANCEL_CURRENT
, FLAG_UPDATE_CURRENT
, or any of the flags as supported by Intent.fillIn()
to control which unspecified parts of the intent that can be supplied when the actual send happens.
Returns:
Returns an existing or new PendingIntent matching the given parameters. May return null only ifFLAG_NO_CREATE
has been supplied.
flags:
(1) android.app.PendingIntent.FLAG_UPDATE_CURRENT
如果PendingIntent已经存在,保留它并且只替换它的extra数据。
(2) android.app.PendingIntent.FLAG_CANCEL_CURRENT
如果PendingIntent已经存在,那么当前的PendingIntent会取消掉,然后产生一个新的PendingIntent。
(3) android.app.PendingIntent.FLAG_ONE_SHOT
PendingIntent只能使用一次。调用了实例方法send()之后,它会被自动cancel掉,再次调用send()方法将失败。
(4) android.app.PendingIntent.FLAG_NO_CREATE
如果PendingIntent不存在,简单了当返回null。
requestCode:
如果一次推送几个通知到通知栏,且requestCode一致的话,PendingIntent里里边的数据会被最后一个推送过来的替换掉,即:第一个推送的数据会跟第二个一样。这点一定要注意。
微信公众账号资源的连接
欢迎关注公众账号 jszj2014215 分享android资讯和技术相关问题
http://mp.weixin.qq.com/s?__biz=MzA3NzMxODEyMQ==&mid=224348184&idx=1&sn=67b5c05163a3cc182b8e9061dde815a1#rd
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。