get information of install app in android
<blockquote>
  <p>hello expert, i need build app that share mobile app to second mobile so that<br>
  i need know that how can i get all app information like : name,date,icon,etc.<br>
  package com.AppInfo;</p>
</blockquote>

<pre><code>import java.util.ArrayList;
import java.util.List;

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

public class AppInfo extends Activity {
    /** Called when the activity is first created. */
     private ListView lView;
     private ArrayList results = new ArrayList();
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);



        }}
class PInfo {
    private String appname = "";
    private String pname = "";
    private String versionName = "";
    private int versionCode = 0;
    private Drawable icon;
    private void prettyPrint() {
       // Log.v(appname + "\t" + pname + "\t" + versionName + "\t" + versionCode);

    }


private ArrayList&lt;PInfo&gt; getPackages() {
    ArrayList&lt;PInfo&gt; apps = getInstalledApps(false); /* false = no system packages */
    final int max = apps.size();
    for (int i=0; i&lt;max; i++) {
        apps.get(i).prettyPrint();
    }
    return apps;
}

private ArrayList&lt;PInfo&gt; getInstalledApps(boolean getSysPackages) {
    ArrayList&lt;PInfo&gt; res = new ArrayList&lt;PInfo&gt;();        
    List&lt;PackageInfo&gt; packs = getPackageManager().getInstalledPackages(0);
    for(int i=0;i&lt;packs.size();i++) {
        PackageInfo p = packs.get(i);
        if ((!getSysPackages) &amp;&amp; (p.versionName == null)) {
            continue ;
        }
        PInfo newInfo = new PInfo();
        newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
        newInfo.pname = p.packageName;
        newInfo.versionName = p.versionName;
        newInfo.versionCode = p.versionCode;
        newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
        res.add(newInfo);
    }
    return res; 
}
</code></pre>
