Don't use Process, use the PackageManager to look up the app info.
On Sun, Jul 12, 2009 at 3:41 AM, sychee <[email protected]> wrote:
>
> Hi, I am trying to retrieve all applications that are running on the
> android phone. Following is the code I have wrote, but how do I get
> the application name into my Array items? Please advise. Thanks.
>
> 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();
> }
> :
> :
> :
>
> >
>
--
Dianne Hackborn
Android framework engineer
[email protected]
Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---