title: How to close a specific activity in android?
body: <p>I have three activity A, B, and C, in which C is an activity to call HOME screen as follows</p>
  
  <pre><code>finish();
  Intent intent = new Intent(Intent.ACTION_MAIN);
  intent.addCategory(Intent.CATEGORY_HOME);
  intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  startActivity(intent);
  </code></pre>
  
  <p>First, the activity A will call the activity B by</p>
  
  <pre><code>Intent B_intent = new Intent(this, B.class);
  B_intent .putExtra("B_Activity", true);
  this.startActivity(B_intent );
  </code></pre>
  
  <p>Then, from A, I also can call the C activity (A do it by using a thread). My problem is how can I clear/ delete/or finish the activity B when I call C activity, so that when I call the B again, it must be go to onCreate() function in B_Activity class
  I try to use the function</p>
  
  <pre><code>if (getIntent().getBooleanExtra("B_Activity", false))
   {
     finish();
   }
  </code></pre>
  
  <p>Thank you so much</p>