我正在开发小型提醒应用程序,它工作正常,但我的问题是我要添加多个提醒
前
(1) 2013 年 8 月 20 日 - 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();
}