I have a problem in our thesis, its all about the BATTERY DOCTOR SAVER what my problem is, the .api list, what i want is to get only the application that is running not the internal system because in my thesis it also show the internal system. Is there a way how to remove that internal system in our task killer? so far this is my code for getting the running application :
public void loadRunningProcesses() {
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> appinfolist = activityManager
.getRunningAppProcesses();
Log.d(TAG, "AppInfoList Size: " + appinfolist.size());
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : appinfolist) {
TaskObject runningtask = new TaskObject();
runningtask.setPid(runningAppProcessInfo.pid);
runningtask.setProcessName(runningAppProcessInfo.processName);
adapter.addTask(runningtask);
runningtask.setProcessName(runningAppProcessInfo.processName.substring(11));
runningtask.setProcessName(runningAppProcessInfo.processName);
}
}
class TaskObject {
int pid;
String processName;
private boolean toKill;
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public boolean isToKill() {
return toKill;
}
public void setToKill(boolean toKill) {
this.toKill = toKill;
}
}
From Polo Ravales:
I already found a solution for this problem. I only use a substring and also make the first letter an uppercase for formality, look at my code :