Android obtains the list of running applications.

Source: Internet
Author: User
Packagesinfo Pi = new packagesinfo (this); 02. 03. activitymanager AM = (activitymanager) getsystemservice (activity_service); 04. // obtain the running application 05. list <runningappprocessinfo> run = aM. getrunningappprocesses (); 06. // obtain the Package Manager, which is obtained by the package name. Program And program name 07. packagemanager PM = This. getpackagemanager (); 08. list <programe> List = new arraylist <programe> (); 09. 10. for (runningappprocessinfo RA: Run) {11. // here, we mainly filter out system applications and phone applications. Of course, you can also comment it out. 12. if (RA. processname. equals ("system") | Ra. processname. equals ("com. android. phone ") {13. continue; 14 .} 15. 16. programe Pr = new Programe (); 17. pr. seticon (Pi. getinfo (RA. processname ). loadicon (PM); 18. pr. setname (Pi. getinfo (RA. processname ). loadlabel (PM ). tostring (); 19. system. out. println (Pi. getinfo (RA. processname ). loadlabel (PM ). tostring (); 20. list. add (PR); 21 .}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.