I am writing a small program to list down the name of the applications
that are running in the background. I have tried achieving this for
the whole afternoon but to no clue on how to get this done. So far, I
have only managed to get the processname, please advise on how I can
retrieve the name of the Application and store in the array items.
Below is a sniplet of my code.
Context context = getApplicationContext();
Resources appR = context.getResources();
ActivityManager actmgr=(ActivityManager)context.getSystemService
(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> appList =
actmgr.getRunningAppProcesses();
CharSequence[] items = new CharSequence[appList.size()];
Vector <Process>allProcesses = new Vector <Process>();
for (int i=0;i<appList.size();i++) {
RunningAppProcessInfo rti = (RunningAppProcessInfo)appList.get
(i);
Process p = new Process (rti.pid,rti.processName,rti.pkgList);
allProcesses.add(p);
items[i] = p.getProcessName();
}
:
:
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---