1.在Notification里面定义一个值
Intent intent = new Intent(MainActivity.this, NotifyActivity.class);
PendingIntent pi = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
Bundle bundle = new Bundle();
bundle.putString("id","123456");
intent.putExtras(bundle);
Notification notify = new Notification();
notify.icon = R.drawable.ico_dog;
notify.tickerText = title;
notify.when = System.currentTimeMillis();
notify.defaults = Notification.DEFAULT_SOUND;
notify.setLatestEventInfo(MainActivity.this, "最新通知", title, pi);
notify.vibrate = new long[]{0, 50, 100, 150};
notify.contentIntent = pi;
notify.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(0x1123, notify);
在NotifyActivity里面这样写获取的id的值为NULL 是为什么
Intent intent = getIntent();
Bundle data = intent.getExtras();
String id = data.getString("id");
求解!!!!!!!!
标签: Android
按票数排序 显示最新答案 共有2个答案 (最后回答: 1年前)
平凡简单1年前
Intent intent = new Intent(MainActivity.this, NotifyActivity.class);
Bundle bundle = new Bundle();
bundle.putString("id","123456");
intent.putExtras(bundle);
PendingIntent pi = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
zilei1年前
嗯 已经解决