title: Why do people like to pair CLEAR_TOP and SINGLE_TOP in android
body: <p>The flag <code>FLAG_ACTIVITY_CLEAR_TOP</code> finds the task containing activity X and clears the top to bring X to its resume state. The flag <code>FLAG_ACTIVITY_SINGLE_TOP</code>, would only keep a single instance of X at the top. Therefore, I should never need to include <code>SINGLE_TOP</code> if I am already using <code>CLEAR_TOP</code>: that's because <code>CLEAR_TOP</code>'s behavior includes <code>SINGLE_TOP</code>'s behavior. So why do so many sample codes include the two together? Is it because those developers don't understand the full power of <code>CLEAR_TOP</code>? Again, almost every example I see online includes the two together. Why the redundancy?</p>
  
  <p>For example if I call <code>CLEAR_TOP</code> for X on the task <code>W-&gt;X-&gt;Y-&gt;Z</code>, then I get <code>W-&gt;X</code>. On the other hand, if I were to call SINGLE_TOP for X on the task <code>W-&gt;X-&gt;Y-&gt;Z</code> I would end up with <code>W-&gt;X-&gt;Y-&gt;Z-&gt;X</code> and if I were to call it for Z I would get <code>W-&gt;X-&gt;Y-&gt;Z</code>. So really <code>CLEAR_TOP</code> adds nothing to the equation: it's like adding 0 to some other value.</p>