title: how to close whole application in android
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3105673/android-how-to-kill-an-application-with-all-its-activities">Android: How to kill an application with all it&#39;s activities?</a>  </p>
  </blockquote>
  
  
  
  <p>I tried with <strong>finish()</strong>.</p>
  
  <p>But it just close the present activity not whole application.
  as the another activity is running hide it shows when i finish the above activity..</p>
  
  <p><strong>CODE :</strong></p>
  
  <pre><code>public class third extends  Activity{
  
  Button btn_back, btn_finish;
  Intent intent2;
  Bundle b1;
  
  
   public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.third);
  
  
          intent2 = getIntent();
          b1=intent2.getExtras();
          String spin = b1.getString("name");
          String gender = b1.getString("gender");
  
  
  
          btn_back = (Button) findViewById(R.id.button1);
          btn_finish = (Button)   findViewById(R.id.button2);
          Toast.makeText(third.this, spin + "" + gender , Toast.LENGTH_SHORT).show();
  
          btn_back.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  intent2 = new Intent (third.this,second.class);
                  startActivity(intent2);
              }
          });
  
          btn_finish.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  finish();
              }
          });
   }
  </code></pre>
  
  <p>}</p>