title: Android PendingIntent take you to an already existing activity?
body: <p>Wasn't really sure how to search for this...</p>
  
  <p>I have a the following which is called whenever a job is added or removed from my queue to put a notification in the status bar:</p>
  
  <pre><code>private void showNotification()
  {
      int jobsize = mJobQueue.size();
      int icon = (jobsize == 0) ? 
          android.R.drawable.stat_sys_upload_done : 
          android.R.drawable.stat_sys_upload;
      Notification notification = 
          new Notification(icon, "Test", System.currentTimeMillis());
      Intent intent = new Intent(this, FileManagerActivity.class);
      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
  
      notification.flags = 
          (Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_AUTO_CANCEL);
      notification.setLatestEventInfo(this, 
          "Uploading to our servers",
          getString((jobsize &gt; 0) ? 
              R.string.notification_active_transfers : 
              R.string.notification_no_transfers),
          pendingIntent);
  
      mNotifyManager.notify(NOTIFICATION, notification);
  }
  </code></pre>
  
  <p>As it is now the behavior is this:</p>
  
  <ul>
  <li><p>if the user logs out and hits the notification, it will still open a new FileManagerActivity (ops!) I could get around this by starting at my authentication activity and passing the intent up my stack in a natural order, its when the application is already running is where I have difficulties. </p></li>
  <li><p>if the user already has the FileManagerActivity open clicking the notification will put a second instance over it. In this case, I want the currently running FileManagerActivity to recieve focus instead of launching a new instance.</p></li>
  </ul>
  
  <p>How could I get the correct behavior? </p>