kill All Process - Android Android OS

Android examples for Android OS:Process

Description

kill All Process

Demo Code


//package com.java2s;
import java.util.List;
import android.app.ActivityManager;

import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.Context;

public class Main {
    public static void killAllProcess(Context context) {

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

        List<RunningAppProcessInfo> list = activityManager
                .getRunningAppProcesses();

        for (RunningAppProcessInfo runningAppProcessInfo : list) {
            activityManager//from w w w.j  a  va 2 s.  c  o  m
                    .killBackgroundProcesses(runningAppProcessInfo.processName);
        }
    }
}

Related Tutorials