title: Finish an activity from another activity
body: <p>I want to finish one activity from another activity, like:</p>
  
  <p>In Activity [A], on button click, I am calling Activity [B] without finishing Activity [A].</p>
  
  <p>Now in Activity [B], there are two buttons, <strong>New</strong> and <strong>Modify</strong>. When the user clicks on modify then pop an activity [A] from the stack with all the options ticked..</p>
  
  <p>But when the user click on <strong>New</strong> button from Activity [B], then I will have to finish Activity [A] from the stack and reload that Activity [A] again into the stack.</p>
  
  <p>I am trying it, but I am not able to finish Activity [A] from the stack... How can I do it?</p>
  
  <p>I am using the code as:</p>
  
  <p>From Activity [A]:</p>
  
  <pre><code>Intent GotoB = new Intent(A.this,B.class);
  startActivityForResult(GotoB,1);
  </code></pre>
  
  <p>Another method in same activity</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  
      if (requestCode == 1)
      {
          if (resultCode == 1) {
              Intent i = getIntent();
              overridePendingTransition(0, 0);
              i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
              finish();
  
              overridePendingTransition(0, 0);
              startActivity(i);
          }
      }
  }
  </code></pre>
  
  <p>And in Activity [B], on button click:</p>
  
  <pre><code>setResult(1);
  finish();
  </code></pre>