标签:android style blog color os io art cti
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"/>
[Android Pro] android 杀死进程的方法,布布扣,bubuko.com
标签:android style blog color os io art cti
原文地址:http://www.cnblogs.com/0616--ataozhijia/p/3876650.html