检查或遍历android手机应程

检查android手机中是否存在某应程

public boolean checkApp(String packageName) {
        if (packageName == null || "".equals(packageName))
            return false;
        try {
            ApplicationInfo info = getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
            return true;
        } catch (NameNotFoundException e) {
            return false;
        }
    }

遍历android手机中的所有应用

 private void foreachSoft() {   

  PackageManager packageMgr = getPackageManager();   

  List<PackageInfo> list = packageMgr.getInstalledPackages(0);  

   for (int i = 0; i < list.size(); i++) {    

    PackageInfo info = list.get(i);    

    String temp = info.packageName;    

    Log.i("lyf", temp);  

   }

 }

 

检查或遍历android手机应程,布布扣,bubuko.com

检查或遍历android手机应程

上一篇:手机页面目录菜单拉进拉出效果小结


下一篇:WebApp 开发中常用的代码片段