title: how to retrieve installed apps with icon in them
body: <p>Below given are the codes in the java and xml file which I have used to retrieve a list of apps from the phone. However it does not retrieve the icon of the apps together with it. Could anyone provide the solution preferably based on the given codes as to how I could go about achieving the objective of retrieving icons for the apps? Help would be much appreciated</p>
  
  <p>xml File:</p>
  
  <pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
  
      &lt;ListView android:id="@+id/list1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
      &lt;/ListView&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>java file:</p>
  
  <pre><code>public class MainActivity extends Activity {
   private ListView lView;
   private ArrayList results;
   List&lt;ResolveInfo&gt; list;
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      results = new ArrayList();
      lView = (ListView) findViewById(R.id.list1);
      PackageManager pm = this.getPackageManager();
  
      Intent intent = new Intent(Intent.ACTION_MAIN, null);
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
  
      list = pm.queryIntentActivities(intent,PackageManager.PERMISSION_GRANTED);
      for (ResolveInfo rInfo : list) 
      {
          results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
          Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
      }
      lView.setAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, results));
  }
  </code></pre>