title: using intent flags and androidmanifest
body: <p>I have a service that starts an activity (say <code>Activity A</code>) as follows:</p>
  
  <pre><code>        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                  | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
          getApplicationContext().startActivity(intent);
  </code></pre>
  
  <p>when I start my app, <code>Activity A</code> appears instead before the app's first activity.</p>
  
  <p>I had 2 solutions to work this around:</p>
  
  <p>1) </p>
  
  <p>changing the above code to:</p>
  
  <pre><code>        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY
                  | Intent.FLAG_ACTIVITY_NEW_TASK);
          getApplicationContext().startActivity(intent);
  </code></pre>
  
  <p><strong>problem</strong>:</p>
  
  <p>after launching the activity and pressing home-key, I still see the activity in the history stack (=<code>recent tasks</code>). how come?</p>
  
  <p>after I launch my app, the two tasks merge into one with the app's first activity at the top. but any other app, create a new task and the task of <code>Activity A</code> remains. how come?</p>
  
  <p>2) 
  changing the above code to:</p>
  
  <pre><code>        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY
                  | Intent.FLAG_ACTIVITY_NEW_TASK);
          getApplicationContext().startActivity(intent);
  </code></pre>
  
  <p>and adding to the manifest:</p>
  
  <pre><code>   &lt;activity
          android:name="org.achartengine.GraphicalActivity"
          android:taskAffinity="org.achartengine"
          &gt;
  </code></pre>
  
  <p>where <code>Activity A</code> =  <code>android:name="org.achartengine.GraphicalActivity"</code></p>
  
  <p><strong>problem</strong>:
  I keep unnecessary task stack.</p>
  
  <p>I assume few people start that activity from the service. And even then they will do it only once. Meaning it would be more neat to clean the activity from any history stack when the user clicks home/back key.</p>
  
  <p>which of the options is preferred? (or another one?)</p>