是否可能只有正在运行的应用程序的名称而不是包名称?我现在有这个代码:
ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = am.getRunningAppProcesses();
if (processes != null){
for (int i=0; i<processes.size(); i++){
RunningAppProcessInfo temp = processes.get(i);
String pName = temp.processName;
Log.d("Running process: ", pName);
}
}
但它返回包名称,如:com.android.camera
. 我只需要camera
或例如Nova launcher
.