Override the onBackPressed
method, and do what happens when they press the home button. It's not really closing all the activities but what you're asking is that the back press in a certain activity emulates the home button.
@Override
public void onBackPressed() {
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
startActivity(i);
}
Placing that in an activity will go home when you press back. Note that the original implementation of the onBackPressed
method includes a call to super, it's removed on purpose. I know this question is super old, but he's explicitly asking something else