0

I was able to get the list of installed application's name in a listview but I'm having problem adding their icons. I have created a new xml layout and included an imageview.

I'm using the following to retrieve the icons

appInfo.icon = p.applicationInfo.loadIcon(getPackageManager());

To load the application info I was using a

HashMap<String,String>.    

It is my understanding that I could use a

HashMap<String,Integer>    

then just send the drawable Resource ID to the Imageview and it would work.

How can I get the Resource Id of a drawable object?

user643097
  • 127
  • 2
  • 15
  • [This answer](http://stackoverflow.com/a/8547313/752320) shows how to get the icon for a given package name. – Geobits Dec 18 '12 at 02:41

1 Answers1

1

Getting a int of a drawable in your app:

int yourInt = getResources().getIdentifier(fileName, "drawable", getPackageName());

Getting an icon from another app:

Android - How to get an icon of an app?

Community
  • 1
  • 1
logray
  • 2,332
  • 1
  • 29
  • 30