I have a notification in my app and I want it to bring back an existing activity when the user clicks it. The notification is genereated within the activity I want to bring back so I assume it still exists.
This is my code for the notification:
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Notification noti = new Notification(R.drawable.icon, "s", 0); CharSequence title = "S"; CharSequence details = "W"; Intent intent = new Intent(getBaseContext(), Start.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); PendingIntent pending = PendingIntent.getActivity(getBaseContext(), 0, intent, 0); noti.setLatestEventInfo(Start.this, title, details, pending); nm.notify(0,noti);
But for some reason it keeps creating a new activity. what am I doing wrong?View original question