2 qq 24752301 qq_24752301 于 2016.03.19 16:00 提问

安卓开发中Nofitication有问题

private void showNotifycation(String number)
{
//拿到Nofitication的管理者
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//new一个Nofitication出来
Notification notification = new Notification(R.drawable.notification, "发现响一声电话", System.currentTimeMillis());
Context context = getApplicationContext();
//设置成一点击就消失
notification.flags = Notification.FLAG_AUTO_CANCEL;
Intent notificationIntent = new Intent(context, NumberSecurityActivity.class);
notificationIntent.putExtra("number", number);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, "响一声号码", number, pendingIntent);
//激活Nofitication
notificationManager.notify(0, notification);
}
这段代码中的Nofitication显示The constructor Notification(int, CharSequence, long) is deprecated

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!