从存储卡中读取带特定后缀的文件
从sd卡中找出:
后缀为.vcf的所有文件:
? ? public static File[] getcontactList() {
? ? ? ? File root = new File(getBackUpPath());
? ? ? ? File[] l = root.listFiles(new FilenameFilter() {
?
? ? ? ? ? ? @Override
? ? ? ? ? ? public boolean accept(File dir, String filename) {
? ? ? ? ? ? ? ? if (filename.endsWith(".vcf")) {
? ? ? ? ? ? ? ? ? ? return true;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? return false;
? ? ? ? ? ? }
? ? ? ? });
? ? ? ? return l;//l为file数组。
? ? }
?
? ? public static String getBackUpPath() {
? ? ? ? return "/mnt/sdcard";//在指定目录中查找。
? ? }