我长话短说,想实现一个功能是在通知栏上显示多个通知,生成多个通知的功能做出来了,我在每个通知中放得pendingIntent都是指向同一个页面,但是在pendingIntent中放的内容不一样,下面我贴出我的代码,那个msgCount是自增的,我很奇怪的是我每次跳转到ShowClass界面里面用getIntent().getExtras()得到的内容如果我设置pendingintent的Flag是PendingIntent.FLAG_UPDATE_CURRENT都是我生成的最后一个通知里我放到pendingIntent中的内容,如果我设置Flag是Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESETname我渠道的都是我生成的第一个通知里的内容,我想实现的是要取到相对应的每个通知中各自的内容,需要怎么弄?因为试验上面的饿两个flag得到的效果不一样所以我估计我的要求应该是能实现的,求指导!
生成通知的代码
msgCount++;
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.app_icon, "tips + " + msgCount, System.currentTimeMillis());
notification.defaults |= Notification.DEFAULT_SOUND; notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.flags |= Notification.FLAG_AUTO_CANCEL; // 在通知栏上点击此通知后自动清除此通知
Context context = getApplicationContext(); // 上下文

Intent notificationIntent = new Intent(MainActivity.this, ShowClass.class); // 点击该通知后要跳转的Activity
Bundle bundle = new Bundle();
bundle.putString("num", msgCount + "");
bundle.putString("notify", "tips + " + msgCount);
notificationIntent.putExtras(bundle);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, 1, notificationIntent, Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET );
notification.setLatestEventInfo(context, "test", "哈哈~ + " + msgCount, contentIntent); nm.notify(msgCount, notification);
showClass取通知内容的的代码protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.showclass);

textView = (TextView) findViewById(R.id.text); Bundle bundle = getIntent().getExtras();
String s1 = bundle.getString("num");
String s2= bundle.getString("notify");

textView .setText(s2); }
急等!!!!!!!!!!!!!!!!!!android通知