setLatestEventInfo方法过时怎么替换

你是机骑猫 2016-03-21 02:05:35
setLatestEventInfo 此方法过时了 求大神基于我的程序 替换一下 实现同样的结果
button.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {

Notification notification = new Notification();
notification.icon = R.drawable.ic_launcher;
notification.tickerText="您有新通知!";
notification.defaults=Notification.DEFAULT_SOUND;
notification.defaults=Notification.DEFAULT_ALL;
notification.setLatestEventInfo(MainActivity.this, "新通知", "查看新通知", pendingIntent);
notificationManager.notify(1000, notification);
}
});
...全文
272 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ganshenml 2016-03-21
  • 打赏
  • 举报
回复
应该是开始使用Notification.Bulder 创建了
=10_01= 2016-03-21
  • 打赏
  • 举报
回复
Android Notification的setLatestEventInfo()@deprecate http://blog.csdn.net/wwzqj/article/details/44098587 可以参考这篇博客,按自己需求改。

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧