Android - How to get an icon of an app?

后端 未结 2 1281
予麋鹿
予麋鹿 2020-12-17 06:05

I am trying to display a list of task in this way -

Icon | ApplicationName | CheckBox

As i found that no listview adapter supports this so i decided to deve

2条回答
  •  暖寄归人
    2020-12-17 06:18

    You can get an app's (package's) icon with:

    String pkg = "com.app.my";
    Drawable icon = getContext().getPackageManager().getApplicationIcon(pkg);
    

提交回复
热议问题