Android获取系统所有应用程序名称
转自:http://blog.sina.com.cn/s/blog_766aa3810100quzv.html
Code示例:
Code示例:
ActivityManager am = (ActivityManager) this .getSystemService(ACTIVITY_SERVICE); List l = am.getRunningAppProcesses(); Iterator i = l.iterator(); PackageManager pm = this.getPackageManager(); while (i.hasNext()) { ActivityManager.RunningAppProcessInfo info = (ActivityManager.RunningAppProcessInfo) (i .next()); try { CharSequence c = pm.getApplicationLabel(pm.getApplicationInfo( info.processName, PackageManager.GET_META_DATA)); Log.w("LABEL", c.toString()); } catch (Exception e) { // Name Not FOund Exception } }