How to get a list of installed android applications and pick one to run

后端 未结 19 1890
误落风尘
误落风尘 2020-11-21 06:26

I asked a similar question to this earlier this week but I\'m still not understanding how to get a list of all installed applications and then pick one to run.

I\'v

19条回答
  •  春和景丽
    2020-11-21 07:19

    Here a good example:

    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 getPackages() {
        ArrayList apps = getInstalledApps(false); /* false = no system packages */
        final int max = apps.size();
        for (int i=0; i getInstalledApps(boolean getSysPackages) {
        ArrayList res = new ArrayList();        
        List packs = getPackageManager().getInstalledPackages(0);
        for(int i=0;i

提交回复
热议问题