Q: Activity opened from Status bar not getting finished I have created a status bar notification , which gives me some message on status bar which when clicked redirects to a totally new layout.
Status bar code - 
NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
         Intent notificationIntent = new Intent(this, TaskCompleteActivity.class);
         notificationIntent.putExtra(TasksDBAdapter.KEY_ROWID, rowId);
         notificationIntent.putExtra(TasksDBAdapter.KEY_TITLE, taskTitle);
         notificationIntent.putExtra(TasksDBAdapter.KEY_BODY, taskDesc);
         //notificationIntent.putExtra("NotificationId", );

         Log.i(TAG,"rowId in doReminderWork" + rowId);
         PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent,PendingIntent.FLAG_ONE_SHOT);  


         Notification note=new Notification(android.R.drawable.stat_sys_warning,taskDesc,System.currentTimeMillis());                              
         note.setLatestEventInfo(this, taskTitle,taskDesc, pi);
         note.defaults |= Notification.FLAG_AUTO_CANCEL;
         note.defaults |= Notification.DEFAULT_SOUND;   
         note.defaults |= Notification.DEFAULT_VIBRATE; 
         // you need to clear the notification on click of status bar notification //
         note.flags |= Notification.FLAG_NO_CLEAR;                              
         // An issue could occur if user ever enters over 2,147,483,647 tasks. (Max int
         // value). 
         // I highly doubt this will ever happen. But is good to note. 
         int id = (int)((long)rowId);                                              
         mgr.notify(id, note);

This layout is having a button called Complete on click of which i am deleting a row in database and calling finish(). Code  - 
public void completeTask(){
        taskDBAdapter.deleteReminder(rowId);
        this.finish();
    }

After this , if I open my application from normal menu, it still shows me this same layout having complete button and not my landing activity. Why is this activity not getting finished ? 
Thanks in Advance,
Kaushik

A: I suggest you take a look at the most recent update of the Notifications API guide online. People are sometimes surprised by what happens when they launch an Activity to deal with a Notification. The options you should use for this are described in the guide.
A rather simplistic summary is that an Activity started by a Notification should be a separate task. If the Activity is a normal part of the app, then users should use Recents to get to the task that was started from the notification. If the Activity is only used for notifications, then the task should be finished once users navigate away.
This pattern preserves the expectations of users regarding the user experience.
In your case, I'm pretty sure that the new Activity you started got "stuck" to your app by TaskAffinity. The API guide will show you how to get around that.
