I’ve a notification bar (2 events every days). A small list of array of string, a method to get a random number and the code below.
I need can click event and open a new activity with string variable show on that activity (not1[x]).
How will do?
random();
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);
just Chagne your code
and just use the code for String