OnItemClickListener that passes the Package Name of the app selected to a method... Help
<p>UPDATE: Now looking for Package Name as opposed to PID</p>

<p>I have an app that diplays a listview of all the installed apps on the device. I want to create an OnItemClickListener that passes the Package Name of the app selected to a method.</p>

<p>Here is my code:</p>

<pre><code>public class Main extends ListActivity {

    private static final int ACTIVITY_CREATE=0;
    public static final int Menu1 = Menu.FIRST;


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        final PackageManager pm = this.getPackageManager();

        Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);

        final ArrayList&lt;ResolveInfo&gt; list =
                (ArrayList&lt;ResolveInfo&gt;) pm.queryIntentActivities(intent, 
                        PackageManager.PERMISSION_GRANTED);
        for (ResolveInfo rInfo : list)
        {
            Log.i("Installed Applications " + rInfo.activityInfo.
                    applicationInfo.loadLabel(pm).toString(), null);
        }

        final ArrayAdapter&lt;ResolveInfo&gt; adapter = 
            new ArrayAdapter&lt;ResolveInfo&gt;(this, R.layout.list_item, list)
            {
            @Override
            public View getView(int position, View convertView, ViewGroup parent)
            {
                if (convertView == null)
                    convertView = LayoutInflater.from(parent.getContext()).
                        inflate(R.layout.list_item, parent, false);

                final String text = list.get(position).activityInfo.
                    applicationInfo.loadLabel(pm).toString();
                ((TextView)convertView.findViewById(R.id.text)).setText(text);

                final Drawable drawable = list.get(position).activityInfo.applicationInfo.loadIcon(pm);
                ((ImageView)convertView.findViewById(R.id.image)).setImageDrawable(drawable);

                return convertView;
            }

            };
        setListAdapter(adapter);

        ListView lv = getListView();
        lv.setTextFilterEnabled(true);
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                int position, long id) {

                // On Item Click Activity

                // This is where I would like to pass the package name to a method
            }
          });
    }
</code></pre>

<p>Any help would be greatly appreciated!</p>
