码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2016-06-17 15:33:02      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

        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());
    }

  

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

标签:

原文地址:http://www.cnblogs.com/hero4china/p/5594130.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!