title: Starting Activity through notification: Avoiding duplicate activities
body: <p>So I am currently showing a notification. When the user clicks this noticiation, the application is started. The notification persists, to indicate that the service is running in the background.</p>
  
  <pre><code>Intent notificationIntent = new Intent(context, LaunchActivity.class);
  PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
  notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
  mNotificationManager.notify(1, notification);
  </code></pre>
  
  <p>However, I have detected a case where a bug appears. If the user starts the application through clicking the normal icon, and while the activity is running clicks the notification, then a new activity is started without the earlier one exiting, the later being on top of the earlier. And that is not all: Further clicks on the notification will create additional activities and place them on top of those already running. How can I prevent this? Is there a nice check to do to see if a certain activity is currently being shown or is loaded?</p>