我有一个通知栏(每天 2 个事件)。字符串数组的小列表,获取随机数的方法和下面的代码。
我需要可以单击事件并在该活动(not1 [x])上打开一个带有字符串变量显示的新活动。
会怎么做?
随机的();
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
int icon = R.drawable.ic_launcher2;
CharSequence tickerText = not1[x];
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
CharSequence contentTitle = "Title";
CharSequence contentText = not1[x];;
Intent notificationIntent = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);