То, что вы хотите - это, по сути, возможность завершить приложение от любого другого действия, отличного от первого.
Я использую переменную приложения, определяющую необходимость закрытия приложения, а затем проверяю ее по методу onresume.
protected void onResume()
{
super.onResume();
if (!getMyApplication().isPlatformActive())
{
/* We finish every activity after resuming if we must shutdown application */
finish();
}
}
boolean isRootScreen()
{
/* Every activity will override this and set it to true if want to exit application from here */
return false;
}
protected void onBackPressed()
{
if(isRootScreen())
{
/* You could show a confirmation dialog here */
getMyApplication().setPlatformActive(false);
}
super.onBackPressed();
}