android – 为什么我在通知中收到弃用警告..?

NotificationManager nm=(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification n=new Notification(android.R.drawable.stat_notify_more , "My Alarm Ringing", System.currentTimeMillis());
Context cn=MainActivity.this;
CharSequence title="My Alarm Clock";
CharSequence details="Alarm Ringing....!!!";
Intent in=new Intent(cn,Alarm.class);
PendingIntent p=PendingIntent.getActivity(cn, 0, in, 0);
n.setLatestEventInfo(cn,title,details,p);
nm.notify(0,n);

在ecllipse中,我在第二行获得通知,而最后一行中的setLatestEventInfo被删除.为什么会这样..?
任何人都可以澄清什么是错误..?
thanx的帮助

解决方法:

Deprecation

a status applied to features, characteristics, or practices to indicate that they should be avoided, typically because they have been superseded.

警告会提醒您目标SDK中已弃用的方法,以便您可以尝试避免使用它.

在此特定上下文中,警告建议您使用Notification.Builder,但是如果您的需要不允许您使用Notification.Builder,由于向后兼容性或其他原因,您可以(很可能)继续使用setLatestEventInfo而不会出现问题.这似乎只是对API的升级,而不是您需要避免的特别重要的事情.

相关文章

Android 如何解决dialog弹出时无法捕捉Activity的back事件 在...
Android实现自定义带文字和图片的Button 在Android开发中经常...
Android 关于长按back键退出应用程序的实现最近在做一个Andr...
android自带的时间选择器只能精确到分,但是对于某些应用要求...