If you want to finish all activities of your application you should maintain this flow.
Assume i am in Activity D. My actual flow is A->B->C->D.i want to kill my previous activities A,B,C. I used to call my first activity A when i am going from Activity D. So i added intent FLAG_ACTIVITY_CLEAR_TOP to call activity A. So the middle activities will cleared and will show only Activity A. And i am passing some flag value as intent extras to activity A. like this
         Intent intent = new Intent(D.this,A.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.putExtra("finishstatus", true);
                this.startActivity(intent);
                this.finish();
and i am checking the bundle value in onCreate method of Activity A like
       bundle = this.getIntent().getExtras();
        if(bundle!= null)
        {
       boolean isActivityToBeFinish =  this.getIntent().getExtras().getBoolean("finishstatus");
            if(isActivityToBeFinish)
            {
                finish();
            }
        }
If the status value available and it is true the i am finishing the activity A also. So my problem is cleared and i am successfully finishing the all previous activities.
May be my explanation is not good but the final work is this only.