android如何获取到启动类的包和类路径

        ArrayList<String> list = new ArrayList<String>();
    private List<ResolveInfo> mApps;
    private ResolveInfo info;
    public void list() {
                        list.clear();
                Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
                mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
                mApps = getPackageManager().queryIntentActivities(mainIntent, 0);
                for (int i = 0; i < mApps.size(); i++) {
                    info = mApps.get(i);
                    String appLabel = info.loadLabel(getPackageManager()).toString();
                    String packagename = info.activityInfo.packageName;
                    String appname = info.activityInfo.name;
                    list.add("appLabel:" + appLabel + " ||  packagename:" + packagename
                            + " ||  appname:" + appname);
                }
                noteText.setText(list.toString());
    }

  

posted @ 2016-06-17 15:22  明将军  Views(2081)  Comments(0Edit  收藏  举报
恨怨悲苦憎怒嗔、仁爱慈孝耻义廉。是故恨人所以得仁,无爱者必不怨,不慈者必无悲,孝而有苦,憎后耻来,义自怒生,廉人心嗔。夹天地七大苦,破人情七大碍,遂舍善恶之心,得称剑神。