我正在使用此方法来获取正在运行的进程
private void getRunningProcess() {
{PackageManager pm=getActivity().getPackageManager();
final ActivityManager manager = (ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> runningProcesses = manager.getRunningAppProcesses();
if (runningProcesses != null && runningProcesses.size() > 0) {
setListAdapter(new ListAdapter(getActivity(), runningProcesses));
}
}
我正在获取所有进程,但我只想显示非系统进程。 任何帮助将不胜感激。
答案 0 :(得分:-1)
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
List<RunningAppProcessInfo> run = am.getRunningAppProcesses();
试试吧!