title: How to hide activities
body: <p>I have two activities. The first activity is running in the foreground. While pressing the home button, the first activity goes to the background and calls the service from there second activity is started using intent. Now the first activity is shown on top. I want to hide both of the activities in the background.</p>
  
  <p>Starting the second <code>Activity</code>:</p>
  
  <pre><code> Intent intent1 = new Intent(XXX.this,yyy.class);
   intent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   startActivity(intent1);
  </code></pre>