title: getting Icons of applications running on device
body: <p>I have a list activity which display all running applications in the device. it's displaying a default icon for all application . but I need to get actual application Icon for each application in the list. </p>
  
  <pre><code>public class ApplicationList extends ListActivity {
  DataHelper dh;
  ImageView vi;
  private Drawable icon;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.applist);
      dh = new DataHelper(getApplicationContext());
  
      PackageManager pm = this.getPackageManager();
  
      Intent intent = new Intent(Intent.ACTION_MAIN, null);
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
  
      Log.d("Test1", "INSERTING APP LIST TO SERVER DB");
       List&lt;ResolveInfo&gt; list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
       ArrayList&lt;String&gt; applist = new ArrayList&lt;String&gt;();
  
       for(ResolveInfo rInfo: list){
  
          applist.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString() );
      }
  
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
              R.layout.installedapp, R.id.textView1, applist);
      setListAdapter(adapter);
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/2384713/how-to-get-the-icon-of-other-applications-android">How to get the icon of other applications (Android)</a>
  I tried this link but I did not get things solved. so can any one help me out. thanks!</p>