Cómo extraer Lista de nombre de aplicación instalada, nombre de paquete e icono dibujable

Estoy tratando de averiguar cómo puedo implementar este código en mi código fuente existente. Actualmente tengo alguna fuente que muestra una vista de lista de todas las aplicaciones instaladas y al hacer clic, se enviará la intención a la aplicación. Necesito ayuda sobre cómo extraer el icono y agregarlo a la vista de lista.

Cualquier ayuda, edición de código fuente, enlaces, etc. me ayudaría a resolver esto.

Gracias

ListInstalledActivitiesActivity

public class ListInstalledActivitiesActivity extends ListActivity {

    // Buffer used to store package and class information, and also determine the number of installed activities
    private ArrayList<String[]> _activitiesBuffer = null;

    // Buffers for package and class information
    private String[] _packages = null;
    private String[] _classes = null;

    // Index used to fill buffers
    private int _index = 0;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main3);
        // Get all installed activities (package and class information for every activity)
        getAllInstalledActivities();              

        // Set content to GUI
        setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, _classes));

        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        // Add listener
        lv.setOnItemClickListener(new OnItemClickListener() {

            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                // When clicked, show a toast with the selected activity
                Toast.makeText(
                    getApplicationContext(), 
                    ((TextView) view).getText(), 
                    Toast.LENGTH_SHORT).show();

                // When clicked, start selected activity, if allowed or possible
                try {

                    Intent intent = new Intent().setClassName(
                            _packages[position], // package 
                            _classes[position]); // class
                    startActivity(intent);

                } catch (Exception e) {
                    Toast.makeText(getApplicationContext(), "Unable to start selected application.", Toast.LENGTH_SHORT);
                }

          } // public void onItemClick(AdapterView<?> parent, View view, int position, long id)

        });

    } // public void onCreate(Bundle savedInstanceState)

    /*
     * Get all installed activities
     */
    private void getAllInstalledActivities() {


        // Initialize activities buffer
        _activitiesBuffer = new ArrayList<String[]>();

        final Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        final List<ResolveInfo> pkgAppsList = getPackageManager().queryIntentActivities( intent, 0);

        Iterator<ResolveInfo> iterator1 = pkgAppsList.iterator();
        while (iterator1.hasNext()) {

            ResolveInfo resolveInfo = iterator1.next();

            String[] buf = new String[] {
                    resolveInfo.activityInfo.packageName, 
                    resolveInfo.activityInfo.name};

            _activitiesBuffer.add(buf);

        } // while (iterator1.hasNext())

        _packages = new String[_activitiesBuffer.size()];
        _classes = new String[_activitiesBuffer.size()];

        Iterator<String[]> iterator2 = _activitiesBuffer.iterator();
        while (iterator2.hasNext()) {

            String[] buf = iterator2.next();

            // Store package information
            _packages[_index] = buf[0]; 

            // Store class information
            _classes[_index] = buf[1];

            _index++;

        } // while (iterator2.hasNext())

    } // private void getAllInstalledActivities()

      }

main3.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >

     <ListView
         android:id="@+id/android:list"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent" />

      <!-- <ImageView -->
      <!--android:id="@+id/ImageView02" -->
      <!--android:layout_width="fill_parent" -->
      <!--android:layout_height="wrap_content" -->
      <!--android:layout_marginBottom="10dp" -->
      <!--android:paddingBottom="5dp" -->


      </LinearLayout>

Respuestas a la pregunta(2)

Su respuesta a la pregunta