安卓(Anroid)杀掉进程。

来源:互联网 发布:东北财经大学就业知乎 编辑:程序博客网 时间:2024/06/04 19:23

在Android开发过程中有需要杀掉进程的操作。

Intent  intent = new Intent(Intent.ACTION_MAIN);
                          intent.addCategory(Intent.CATEGORY_HOME);
                          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                          startActivity(intent);
                          android.os.Process.killProcess(android.os.Process.myPid());

0 0
原创粉丝点击