Installed application list doesn't show icon in the list in android
<p>I am trying to get a list of all installed application in my android device. Here is my code in the launcher app:</p>

<pre><code>package com.powergroupbd.appfilter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ApplicationFilterActivity extends Activity {
    /** Called when the activity is first created. */

    ListView appfilter;
    // ArrayAdapter&lt;Applications&gt; adapter;
    PackageManager pck;
    private ArrayList&lt;Applications&gt; results = new ArrayList&lt;Applications&gt;();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        appfilter = (ListView) findViewById(R.id.lvApp);

        PackageManager packageManager = this.getPackageManager();
        List&lt;PackageInfo&gt; applist = packageManager.getInstalledPackages(0);
        Iterator&lt;PackageInfo&gt; it = applist.iterator();
        while (it.hasNext()) {
            PackageInfo pk = (PackageInfo) it.next();
            // if(PackageManager.PERMISSION_GRANTED==packageManager.checkPermission(Manifest.permission.ACCESS_FINE_LOCATION,
            // pk.packageName) &amp;&amp;
            // PackageManager.PERMISSION_GRANTED==packageManager.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION,
            // pk.packageName)) //checking if the package is having INTERNET
            // permission
            // {
            results.add(get(pk.applicationInfo.loadIcon(getPackageManager()), ""+pk.applicationInfo.loadLabel(packageManager)));
            Log.i("AppName", ""+pk.applicationInfo.loadLabel(packageManager));


            // }
        }

        // Collections.sort(results, new Comparator&lt;Applications&gt;() {
        // @Override
        // public int compare(Applications c1, Applications c2) {
        // return c1.getAppname().compareToIgnoreCase(c2.getAppname());
        // }
        // });

        appfilter.setAdapter(new ArrayAdapter&lt;Applications&gt;(this,
                android.R.layout.simple_list_item_1, results));
    }



    private Applications get(Drawable icon, String appname) {
        return new Applications(icon, appname);
    }
}
</code></pre>

<p>My custom adapter class is here:</p>

<pre><code>package com.powergroupbd.appfilter;

import java.util.List;

import android.app.Activity;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Customarrayadapter extends ArrayAdapter&lt;Applications&gt; {

    private final List&lt;Applications&gt; list;
    private final Activity context;

    public Customarrayadapter(Activity context, List&lt;Applications&gt; list) {
        super(context, R.layout.row, list);
        this.context = context;
        this.list = list;
    }

    static class ViewHolder {

        protected ImageView icon;
        protected TextView appame;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = null;
        if (convertView == null) {
            LayoutInflater inflator = context.getLayoutInflater();
            view = inflator.inflate(R.layout.row, null);
            final ViewHolder viewHolder = new ViewHolder();
            viewHolder.icon = (ImageView) view.findViewById(R.id.ivIcon);
            viewHolder.appame = (TextView) view.findViewById(R.id.tvAppName);
            viewHolder.appame.setTextColor(Color.WHITE);



            view.setTag(viewHolder);
        } else {
            view = convertView;

        }

        ViewHolder holder = (ViewHolder) view.getTag();
        holder.icon.setImageDrawable(list.get(position).getIcon());
        holder.appame.setText(list.get(position).getAppname());



                return view;
    }
}
</code></pre>

<p>And here is my Applications Class:</p>

<pre><code>package com.powergroupbd.appfilter;

import android.graphics.drawable.Drawable;

public class Applications {

    private Drawable icon;
    private String appname;

    public Applications(Drawable icon, String appname) {

        this.icon = icon;
        this.appname = appname;

    }

    public Drawable getIcon() {
        return icon;
    }

    public void setIcon(Drawable icon) {
        this.icon = icon;
    }

    public String getAppname() {
        return appname;
    }

    public void setAppname(String appname) {
        this.appname = appname;
    }

}
</code></pre>

<p>finally the manifest is:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.powergroupbd.appfilter"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk android:minSdkVersion="8" /&gt;

    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
        &lt;activity
            android:name=".ApplicationFilterActivity"
            android:label="@string/app_name" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>If I run the program, then it just shows a list of some garbage string value(com.powergroupbd.appfilter.Applications@44297...) without any icon.</p>

<p>How can I fix it?</p>
