title: ResolveInfo getIconResource() giving really strange results (incorrect icons)
body: <p>I'm creating a list of applications installed on the phone. I'm retrieving all installed application with the <code>PackageManager</code>and <code>ResolveInfo</code>. Due to memory issue i'm using <code>getIconResource()</code> instead of <code>loadIcon()</code>.</p>
  
  <p>My question is how do i display the correct icons in an imageView using the iconResource, the int?</p>
  
  <p><strong>EDIT: added code</strong></p>
  
  <p>this is the part where i create a list with installed apps get stored in an Arraylist <code>apps</code></p>
  
  <pre><code>private void loadApps(){
          manager = getPackageManager();
          apps = new ArrayList&lt;AppDetail&gt;();
  
          if(apps.size()==0) {
              Intent i = new Intent(Intent.ACTION_MAIN, null);
              i.addCategory(Intent.CATEGORY_LAUNCHER);
              List&lt;ResolveInfo&gt; availableActivities = manager.queryIntentActivities(i, 0);
              for (ResolveInfo ri : availableActivities) {
                  AppDetail app = new AppDetail();
                  app.label = ri.loadLabel(manager);
                  app.name = ri.activityInfo.packageName;
                  app.icon = ri.activityInfo.getIconResource();
                  app.allowed = false;
                  apps.add(app);
              }
              Log.i("applist", apps.toString());
          }
      }
  </code></pre>
  
  <p>In an ArrayAdapter i want put the set the icons in an ImageView</p>
  
  <pre><code>ImageView appIcon = (ImageView)convertView.findViewById(R.id.item_app_icon);
              int id = apps.get(position).icon;
              appIcon.setImageResource(id);
  </code></pre>
  
  <p>This is the result on the phone, its displaying strange icons (some apps even use google plus icons:</p>
  
  <p><img src="https://i.stack.imgur.com/3yBlV.jpg" alt="enter image description here"></p>
  
  <p>It also gives errors about not finding the resource:</p>
  
  <p><code>W/ResourceType﹕ getEntry failing because entryIndex 1 is beyond type entryCount 1
   W/ResourceType﹕ Failure getting entry for 0x7f030001 (t=2 e=1) in package 0 (error -2147483647)
   W/ImageView﹕ Unable to find resource: 2130903041</code></p>