exit button not working properly
<p>I have developed app I want to write code for exit button.I was searching code for exit button and I got it from internet.Now the exit button code is working properly but when i open app from the emulator it is opening directly 3rd activity. Splash screen and second activity are unseen i don't know where i am going wrong   </p>

<p>This is the code for exit button</p>

<pre><code>public void onClick(View v) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    finish();
    startActivity(intent);
}
</code></pre>

<p>can you please tell me code where</p>

<p><strong>my manifest file is</strong> </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.finan"
android:versionCode="1"
android:versionName="1.0" &gt;
&lt;uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" /&gt;
&lt;supports-screens 
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:resizeable="true"

android:anyDensity="true"/&gt;
&lt;application
    android:allowClearUserData="true"
    android:icon="@drawable/dollar"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"&gt;
    &lt;activity
        android:name="com.app.finan.Splashscreen"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity
        android:name="com.app.finan.MainActivity"
        android:label="@string/app_name" 
        android:theme="@style/AppBaseTheme"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity
        android:name="com.app.finan.second"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity
        android:name="com.app.finan.Monthc"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
           &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>
