title: Is there any difference among Intent.FLAG_ACTIVITY_CLEAR_TOP and Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP
body: <p>I was wondering, what is the difference between the 2 code?</p>
  
  <pre><code>newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
  </code></pre>
  
  <hr>
  
  <pre><code>newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
  </code></pre>
  
  <h2>FLAG_ACTIVITY_CLEAR_TOP</h2>
  
  <blockquote>
    <p>If set, and the activity being launched is already running in the
    current task, then instead of launching a new instance of that
    activity, all of the other activities on top of it will be closed and
    this Intent will be delivered to the (now on top) old activity as a
    new Intent.</p>
  </blockquote>
  
  <h2>FLAG_ACTIVITY_SINGLE_TOP</h2>
  
  <blockquote>
    <p>If set, the activity will not be launched if it is already running at
    the top of the history stack.</p>
  </blockquote>
  
  <p>My understanding is</p>
  
  <ul>
  <li><code>FLAG_ACTIVITY_CLEAR_TOP</code> - Clear all activities on the top, and prevent more than 1 instance of same Activity within a same task stack.</li>
  <li><code>FLAG_ACTIVITY_SINGLE_TOP</code> - Prevent more than 1 instance of same Activity within a same task stack.</li>
  </ul>
  
  <p>If my understanding is correct, isn't <code>Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP</code> seems redundant?</p>
  
  <p>Can we just write <code>Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP</code>?</p>