Unable to close all activities on android eclipse
===

Assume i have four classes.Each class is having a button to do screen switching from one page to another page,well its working fine.But now im trying to close all the activities by clicking the button from the last page.I have tried that too, but its just closing only the last page.How to achieve this concept?


Please find my code for reference

**XitActivity.java**

    public class Xit_demoActivity extends Activity {
    /** Called when the activity is first created. */
    
	Button btn1; 
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        btn1 = (Button)findViewById(R.id.button_1);
        btn1.setOnClickListener(new View.OnClickListener() {
			
		public void onClick(View v) {
		Intent myIntent = new Intent(v.getContext(), Class1.class);
        startActivity(myIntent);
			}
		});


**Class1.java**

    public class Class1 extends Activity 
    {

	Button btn1;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main1);
		
		btn1 = (Button)findViewById(R.id.button_2);
        btn1.setOnClickListener(new View.OnClickListener() {
			
		public void onClick(View v) {
		Intent myIntent = new Intent(v.getContext(), Class2.class);
        startActivity(myIntent);
			}
		});


**Class2.java**

    public class Class2 extends Activity 
    {
	
	Button btn1;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main2);
	
		
		btn1 = (Button)findViewById(R.id.button_3);
        btn1.setOnClickListener(new View.OnClickListener() {
			
		public void onClick(View v) {
		Intent myIntent = new Intent(v.getContext(), Class3.class);
        startActivity(myIntent);
			}
		});


**Class3.java**

    public class Class3 extends Activity 
    {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main3);

		Button next = (Button) findViewById(R.id.button_4);
		next.setOnClickListener(new View.OnClickListener() {
			
		public void onClick(View v) 
		{
		    Intent intent = new Intent();
	        setResult(RESULT_OK, intent);
	        finish();
	    	}
		});


**Manifest.xml**

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.and.roidu.xit"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".Xit_demoActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity><activity android:name=".Class1"></activity>

        <activity
            android:name=".Class1"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN1" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity><activity android:name=".Class2"></activity>
        
        
        
        <activity
            android:name=".Class2"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN2" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity><activity android:name=".Class3"></activity>
        
        <activity
            android:name=".Class3"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN3" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        
     </application>

    </manifest>

Thanks for your time!..