2012-07-09 28 views
-7

可能重複:
How to get a list of installed android applications and pick one to run列出安裝/ android系統中運行的應用程序編程

我們已經使用Android手機。

  1. 如何列出All Installed Applications
  2. 如何列出All Running Applications

幫幫我。謝謝。

+0

如何通過編程列出所有應用程序? – 2012-07-09 08:33:07

+0

檢查這個職位的演示... http://whats-online.info/science-and-tutorials/42/Android-tutorial-list-installed-apps-package-name-programmatically/ ..它會幫助你 – 2016-11-13 04:53:13

回答

23

要獲得安裝在Android活動/應用程序的列表:How to get a list of installed android applications and pick one to run

要檢查所有正在運行的應用程序

ActivityManager actvityManager = (ActivityManager) 
this.getSystemService(ACTIVITY_SERVICE); 
List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses(); 

簡稱來源:

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); 
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); 
final List pkgAppsList = context.getPackageManager().queryIntentActivities(mainIntent, 0); 

從推介: http://www.dreamincode.net/forums/topic/138412-android-20-list-of-running-applications/

注意:以上描述的函數將返回以下API 21的正確結果,對於21以及更高版本,它已被棄用。

+0

謝謝。它列出了所有的應用程序。如何識別以編程方式列出當前正在運行的應用程序? – 2012-07-09 08:37:55

+0

檢查編輯的代碼 – Ponmalar 2012-07-09 08:45:46

+0

感謝Ponmalar。這對我和其他人有用。 – 2012-07-09 09:05:10

相關問題