title: Launching an activity at its current state
body: <p>I am trying to make a task switcher and I succeeded in it. My only problem is that when I launch activities, they are relaunched as they were new activities ( for instance, I am writing an email, I press home and go into my activity,launch email, and then the app launch the email bout goes back to the inbox and the email is lost) So that's not true multitasking.</p>
  
  <p>Here are my steps:</p>
  
  <p>1) getting all the running apps:</p>
  
  <p><code>List&lt;ActivityManager.RunningTaskInfo&gt; allTasks = activityManager.getRunningTasks(30);</code></p>
  
  <p>2) getting the intent:</p>
  
  <pre><code>for (ActivityManager.RunningTaskInfo aTask : allTasks) {
          Intent i = new Intent(Intent.ACTION_MAIN);
          i.setComponent(aTask.baseActivity);
  (...)
  </code></pre>
  
  <p>3) Launching the application when clicking on the button:</p>
  
  <pre><code>    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED).addCategory(Intent.CATEGORY_LAUNCHER);
      monthis.startActivity(intent);
  </code></pre>
  
  <p>`</p>
  
  <p>What is wrong with this code? Should I do something different to get it?</p>
  
  <p>Thank a lot for any answer.</p>