Android Notification.setLatestEventInfo(...)
16lz
2021-01-23
http://blog.csdn.net/y815007145/article/details/6205472
此文主要讲解 setLatestEventInfo的作用,他是Notification 的一个方法。下面以实际代码讲解用法。
Notification notification = new Notificatio(drawable,tickerText,System.currentTimeMillis()); //此处定义了一个Notification ,其中第一个参数代表图标
第二个参数代表提示的内容,第三个参数是指要显示的时间,一般是当即显示,故填入系统当前时间。
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ActivityMain.class), 0);//该语句的作用是定义了一个不是当即显示的activity,只有当用户拉下notify显示列表,并且单击对应的项的时候,才会触发系统跳转到该activity.
notification.setLatestEventInfo(this, title, content, contentIntent);//在此处设置在nority列表里的该norifycation得显示情况。
mNotificationManager.notify(NOTIFICATIONS_ID, notification);
更多相关文章
- android SmartTabLayout——自定义标题带的Android ViewPager
- android自定义button样式
- 百度地图自定义公交路线源码
- Android 7.0自定义dialog错误permission denied for window type
- android 自定义dialog,窗口动画,
- android 自带APP 作用
- Android 自定义控件 ViewPager头部指示器控件 ViewPagerBelowInd