Skip to content Skip to sidebar Skip to footer

How To Use Getrunningappprocesses() In Android?

i have the following piece of code : package com.example.task; import java.util.List; import android.os.Bundle; import android.app.Activity; import android.app.ActivityManager; i

Solution 1:

In this line

processesShow.setText((CharSequence) runningProcesses);

you are casting a List into a CharSequence. Try something along these lines:

StringBuilder b = new StringBuilder();
for (ActivityManager.RunningAppProcessInfo process: runningProcesses) {
    b.append(processs.processName);
    b.append("\n");
}
processesShow.setText(b.toString());

Post a Comment for "How To Use Getrunningappprocesses() In Android?"