What you need to do is call finish() to remove the Activity from the stack. Then, in your notification, you call the name Activity , which is called when you click on it, something like this:
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, "A new notification", System.currentTimeMillis()); // Specify the called Activity Intent intent = new Intent(this, YourActivityName.class); intent.putBoolean("isDownloading", true); // check this value in Activity PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0); notification.setLatestEventInfo(this, "This is the title", "This is the text", activity); notificationManager.notify(0, notification);
source share