void java.lang.System.exit(int code)public static void exit (int code) Since: API Level 1 Causes the virtual machine to stop running and the program to exit. If runFinalizersOnExit(boolean) has been previously invoked with a true argument, then all all objects will be properly garbage-collected and finalized first.Parameters code the return code. Throws SecurityException if the running thread has not enough permission to exit the virtual machine.
退Activity: android.app.Activity.finish();
Since: API Level 1
Causes the virtual machine to stop running and the program to exit. If runFinalizersOnExit(boolean) has been previously invoked with a true argument, then all all objects will be properly garbage-collected and finalized first.Parameters
code the return code. Throws
SecurityException if the running thread has not enough permission to exit the virtual machine.
退activity 不一定退进程。
进程直接自杀 方便快捷 居家旅行必备
或者用System.exit(0);
都报错误呢~ 程序关闭是关了 一关闭就卡一会 然后跳出应用程序没有响应 晕
退出时再加一句:System.exit(0);就没有之前的数据状态了。
killprocess方法 能结束任务
但是对于多Activity的工程 怎么执行killprocess方法和system.exit()方法 仍然返回上 一 个Activity而不是退出这个程序呢
Activity A登录
Activity B主页面在B中有退出系统按钮,触发事件执行 finish();这时候,系统退回A页面,如果这时候想直接关闭A页面,
则可以重写restart()方法,在里面加入finish();即可。这样有点麻烦,确实能解决问题。
java C#标准退出法