[Java] Android获得当前安装的所有应用程序列表 →→→→→进入此内容的聊天室

来自 , 2019-09-28, 写在 Java, 查看 106 次.
URL http://www.code666.cn/view/ee0e9524
  1. public void onCreate(Bundle savedInstanceState) {
  2.     super.onCreate(savedInstanceState);
  3.     setContentView(R.layout.main);
  4.     lView = (ListView) findViewById(R.id.list1);
  5.  
  6.     PackageManager pm = this.getPackageManager();
  7.     Intent intent = new Intent(Intent.ACTION_MAIN, null);
  8.     intent.addCategory(Intent.CATEGORY_LAUNCHER);
  9.  
  10.     List list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
  11.  
  12.     for (ResolveInfo rInfo : list) {
  13.         results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
  14.         Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
  15.     }
  16.  
  17.     lView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_ list_item_1, results));
  18. }
  19. //java/5850

回复 "Android获得当前安装的所有应用程序列表"

这儿你可以回复上面这条便签

captcha