I am developing the application in which i want to close whole application on button click. I know in android we should not think about to close the application because andr
As other answers have the following should work.
Intent intent = new Intent(Activity3.this, FinishActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
For API level < 11, Intent.FLAG_ACTIVITY_CLEAR_TASK is not available. Instead I used IntentCompat.FLAG_ACTIVITY_CLEAR_TASK from support library.
See IntentCompat
Might help someone stumbling across.