我尝试创建多个通知。如果单击通知,它将链接到另一个活动。在下面的代码之后,它创建了两行通知。但是当我点击通知的第一行时,它不起作用。只有第二个作品。
for (int i = 0; i < missionName.size(); i++) {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.icon,
"Mission Completed, Click Me!", System.currentTimeMillis());
notifyDetails.defaults |= Notification.DEFAULT_SOUND;
notifyDetails.defaults |= Notification.DEFAULT_VIBRATE;
Context context = getApplicationContext();
CharSequence contentTitle = missionName.get(i) + " is completed";
CharSequence contentText = "Please click to view the mission";
Intent notifyIntent = new Intent(getApplicationContext(),MissionMap.class);
notifyIntent.putExtra("missionName", missionName.get(i));
PendingIntent intent = PendingIntent.getActivity(ApplicationMenus.this,
0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText,
intent);
mNotificationManager.notify(i, notifyDetails);
}
所以,请帮我找出我的错误。非常感谢。