Note that there are some explanatory texts on larger screens.

plurals
  1. POGet simple name for the running application
    primarykey
    data
    text
    <p>How can i make my code to show only the name of running application which i can kill, because in my code it show the package name and that is very confusing for the user. And also, i want it to have an icon beside the application so that the user will identify it easily. i got this code from the internet and i used it for my project. Here is my code:</p> <pre><code> private List&lt;TaskObject&gt; getTasksToKill() { List&lt;TaskObject&gt; tol = new ArrayList&lt;TaskObject&gt;(); for (int i = 0; i &lt; adapter.getCount(); i++) { TaskObject to = adapter.getItem(i); if (to.isToKill()) { tol.add(to); } } return tol; } public void loadRunningProcesses() { ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List&lt;RunningAppProcessInfo&gt; 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); } } 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; } } } } </code></pre> <p>Hoping for all of your answers and recommendation. Thank you for all of your help :) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload