public void showDir(String dir) { try { File fDir = new File(dir); if (fDir.exists()) { File[] files = fDir.listFiles(); if (files != null) { List<SysappSelectApkItem> list = new ArrayList<SysappSelectApkItem>(); for (File f : files) { if (!f.getName().startsWith(".")) { if (f.isDirectory() || f.getName().endsWith(".apk")) { SysappSelectApkItem item = new SysappSelectApkItem(); if (!f.isDirectory()) { item.iconImg = ApkUtils.getIconFromPackage(getActivity(), f.getAbsolutePath()); } item.icon = f.isDirectory() ? 1 : 0; item.filename = f.getName(); item.level = ApkUtils.getAppLevel(f.getAbsolutePath(), ""); list.add(item); } } } adapter = new SysappSelectApkAdapter(list, getActivity().getLayoutInflater()); } } } catch (Throwable th) { adapter = null; } }