1: 杀死自己进程的方法

android.os.Process.killProcess(Process.myPid());

2:杀死别人进程的方法(不能杀死自己)

-------a: activityManager.killBackgroundProcesses



ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
activityManager.killBackgroundProcesses("com.android.mms");


需要加入权限:



<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>


--------b :activityManager.restartPackage("com.diandian");



ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

activityManager.restartPackage("com.diandian");


需要加入权限



<uses-permission android:name="android.permission.RESTART_PACKAGES"/>