Android:打开活动而不保存到堆栈中
我有2个活动:主要和列表。
从Main可以打开List; 从List中可以打开Main。
我喜欢这样,每一个列表的开放不会被保存到“历史”。 所以,从Main按下不能返回到List。
可能吗?
 当开始你的列表的Activity ,设置其Intent标志,如下所示: 
 Intent i = new Intent(...); // Your list's Intent i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); // Adds the FLAG_ACTIVITY_NO_HISTORY flag startActivity(i); 
  FLAG_ACTIVITY_NO_HISTORY标志将新的Activity添加到历史堆栈中。 
 注意:正如@Sam指出的,你可以使用i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); 代替。 没有function差异。 
在清单文件中添加:
 android:noHistory="true" 
到您不想保留在堆栈上的活动。
使用清除新的任务。 当其他选项没有时,这在我的情况下工作。
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); 
清除整个历史堆栈并在Android上开始新的活动
看起来,如果在打开另一个打开的对象后立即调用finish(),那么完成的打印将从堆栈中移除。
例如:
 Intent intent = new Intent(this, NextActivity.class); startActivity(intent); finish(); 
 将标志FLAG_ACTIVITY_NEW_TASK添加到您的Intent 
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK
 在我的具体情况下, FLAG_ACTIVITY_NO_HISTORY不起作用。  FLAG_ACTIVITY_NEW_TASK或FLAG_ACTIVITY_CLEAR_TASK本身也不能工作。 
 但是, FLAG_ACTIVITY_NEW_TASK和FLAG_ACTIVITY_CLEAR_TASK一起工作。 
 Intent intent = new Intent(FooActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); 
你能不能重写特定活动的后退button来停止“返回”function?
 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } return super.onKeyDown(keyCode, event); }