Get Application Info from package name

后端 未结 4 1137
太阳男子
太阳男子 2020-12-29 05:59

I have an application package name. Is there any way to get the icon, name of this application ? package name example: com.example.name

4条回答
  •  长发绾君心
    2020-12-29 06:49

    if you want to get installed app package name then this code will be helpful to you.

     Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
                    mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
                    List pkgAppsList = MainActivity.this.getPackageManager().queryIntentActivities( mainIntent, 0);
                    Log.i("InstalledAPK",pkgAppsList.toString());
    
    
                  for(int i=0;i adapter=new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1,list);
                    listView.setAdapter(adapter);
    

提交回复
热议问题