我開發小提醒應用程序它工作正常,但我的問題是我添加多個提醒無法顯示多餘
前
(1)8月20日 - 2013 - 7(小時)-35 (分鐘)
(2)2013年8月20日 - 7(小時)-36(分鐘)
我的提醒應用程序只顯示第二個從不顯示第一個。
我的源代碼:
用於獲取時間和消息:在當時
public void onDateSelectedButtonClick(View v) {
int day = datePicker.getDayOfMonth();
int month = datePicker.getMonth();
int year = datePicker.getYear();
int hour = timePicker.getCurrentHour();
int minute = timePicker.getCurrentMinute();
message = message_text.getText().toString();
title = title_text.getText().toString();
Toast.makeText(getApplicationContext(), message+ ""+title, Toast.LENGTH_LONG).show();
Calendar calender = Calendar.getInstance();
calender.set(year, month, day,hour,minute,0);
ScheduleClient.setAlarmForNotification(calender);
Toast.makeText(getApplicationContext(), "Notification of day"+ day+"/"+ month, Toast.LENGTH_LONG).show();
}
顯示消息:
private static int NOTIFICATION = 1;
private void showNotification() {
CharSequence title = "Alarm";
int icon = R.drawable.ic_launcher;
CharSequence text = "Notification";
long time = System.currentTimeMillis();
Notification notification = new Notification(icon,text,time);
Intent intent = new Intent(this,ShowActivity.class);
String body = TaskReminder.title;
String message = TaskReminder.message;
intent.putExtra("title", body);
intent.putExtra("message", message);
PendingIntent pi= PendingIntent.getActivity(this, NOTIFICATION, intent, 0);
notification.setLatestEventInfo(this, title, text, pi);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(NOTIFICATION++, notification);
stopSelf();
}
謝謝我解決了這個問題。 – Arut