close the activity after finish
<p>i have question 
in android 
after i click to button to go to updateprofile how can i close  the previous activity
for example</p>

<pre><code>x.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent activity2 = new Intent(getApplicationContext(),
                    updateprofile.class);
            startActivity(updateprofile);


        }
    });
</code></pre>

<p>which method i can call to close the previous activity can you help me 
thanks</p>
