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的幫助爲什麼我在通知中得到棄用警告..?
什麼API來編譯你的代碼不能使用setLatestEventInfo()你在用嗎? – 2013-01-15 05:40:55
請參閱[here](http://developer.android.com/reference/android/app/Notification.html)'setLatestEventInfo方法在API級別11中已棄用。使用Notification.Builder替代' –
即時使用API級別17 – Scorpian