Application won't exit after pressing noticication
===

I started a notification with the code as follows. If i start the Notification from an app with a button, it will start, if i press an 'Exit' button on the same App it will clear the Notification and exit.

However, if i close the App after the Notification up start the app again with the Notification using a PendingIntent. The App 'Exit' button will clear the Notification, but will not exit the app unless it is pressed again.

I want it to clear Notification and exit, regardless of how the App in opened.

Can any one help please, wha am i dong wrong.


    public void onClick(View v) {

		switch (v.getId()) {
		case R.id.bStat:
			Intent intent = new Intent(this, NotifyActivity.class);
			PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
			String body = "This is a Test..";
			String title = "XxxXxx Xxxxx..";
			Notification n = new Notification(R.drawable.ttsn, body,
					System.currentTimeMillis());
			n.setLatestEventInfo(this, title, body, pi);
			n.defaults = 0;
			// Notification.DEFAULT_ALL
			nm.notify(uniqueID, n);
			break;
			
		case R.id.bExit:
			nm.cancel(uniqueID);
			finish();
			break;
		}

	}


